TIBCO EMS development
This commit is contained in:
5
src/Spring/Spring.Messaging.Ems/AssemblyInfo.cs
Normal file
5
src/Spring/Spring.Messaging.Ems/AssemblyInfo.cs
Normal file
@@ -0,0 +1,5 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyTitle("Spring.Messaging.Ems")]
|
||||
[assembly: AssemblyDescription("TIBCO EMS support")]
|
||||
@@ -0,0 +1,9 @@
|
||||
|
||||
|
||||
namespace Spring.Messaging.Ems.Common
|
||||
{
|
||||
public class CertificateStoreConfig
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -71,29 +71,29 @@ namespace Spring.Messaging.Ems.Common
|
||||
return new EmsConnection(nativeConnection);
|
||||
}
|
||||
|
||||
public object GetCertificateStore()
|
||||
public object CertificateStore
|
||||
{
|
||||
return nativeConnectionFactory.GetCertificateStore();
|
||||
get { return nativeConnectionFactory.GetCertificateStore(); }
|
||||
}
|
||||
|
||||
public string GetSSLProxyHost()
|
||||
public string SSLProxyHost
|
||||
{
|
||||
return nativeConnectionFactory.GetSSLProxyHost();
|
||||
get { return nativeConnectionFactory.GetSSLProxyHost(); }
|
||||
}
|
||||
|
||||
public string GetSSLProxyPassword()
|
||||
public string SSLProxyPassword
|
||||
{
|
||||
return nativeConnectionFactory.GetSSLProxyPassword();
|
||||
get { return nativeConnectionFactory.GetSSLProxyPassword(); }
|
||||
}
|
||||
|
||||
public int GetSSLProxyPort()
|
||||
public int SSLProxyPort
|
||||
{
|
||||
return nativeConnectionFactory.GetSSLProxyPort();
|
||||
get { return nativeConnectionFactory.GetSSLProxyPort(); }
|
||||
}
|
||||
|
||||
public string GetSSLProxyUser()
|
||||
public string SSLProxyUser
|
||||
{
|
||||
return nativeConnectionFactory.GetSSLProxyUser();
|
||||
get { return nativeConnectionFactory.GetSSLProxyUser(); }
|
||||
}
|
||||
|
||||
public void SetCertificateStoreType(EMSSSLStoreType type, object storeInfo)
|
||||
@@ -101,74 +101,74 @@ namespace Spring.Messaging.Ems.Common
|
||||
nativeConnectionFactory.SetCertificateStoreType(type, storeInfo);
|
||||
}
|
||||
|
||||
public void SetClientID(string clientID)
|
||||
public string ClientID
|
||||
{
|
||||
nativeConnectionFactory.SetClientID(clientID);
|
||||
set { nativeConnectionFactory.SetClientID(value); }
|
||||
}
|
||||
|
||||
public void SetClientTracer(StreamWriter tracer)
|
||||
public StreamWriter ClientTracer
|
||||
{
|
||||
nativeConnectionFactory.SetClientTracer(tracer);
|
||||
set { nativeConnectionFactory.SetClientTracer(value); }
|
||||
}
|
||||
|
||||
public void SetConnAttemptCount(int attempts)
|
||||
public int ConnAttemptCount
|
||||
{
|
||||
nativeConnectionFactory.SetConnAttemptCount(attempts);
|
||||
set { nativeConnectionFactory.SetConnAttemptCount(value); }
|
||||
}
|
||||
|
||||
public void SetConnAttemptDelay(int delay)
|
||||
public int ConnAttemptDelay
|
||||
{
|
||||
nativeConnectionFactory.SetConnAttemptDelay(delay);
|
||||
set { nativeConnectionFactory.SetConnAttemptDelay(value); }
|
||||
}
|
||||
|
||||
public void SetConnAttemptTimeout(int timeout)
|
||||
public int ConnAttemptTimeout
|
||||
{
|
||||
nativeConnectionFactory.SetConnAttemptTimeout(timeout);
|
||||
set { nativeConnectionFactory.SetConnAttemptTimeout(value); }
|
||||
}
|
||||
|
||||
public void SetHostNameVerifier(EMSSSLHostNameVerifier verifier)
|
||||
public EMSSSLHostNameVerifier HostNameVerifier
|
||||
{
|
||||
nativeConnectionFactory.SetHostNameVerifier(verifier);
|
||||
set { nativeConnectionFactory.SetHostNameVerifier(value); }
|
||||
}
|
||||
|
||||
public void SetMetric(int metric)
|
||||
public int MetricAsInt
|
||||
{
|
||||
nativeConnectionFactory.SetMetric(metric);
|
||||
set { nativeConnectionFactory.SetMetric(value); }
|
||||
}
|
||||
|
||||
public void SetMulticastDaemon(string port)
|
||||
public string MulticastDaemon
|
||||
{
|
||||
nativeConnectionFactory.SetMulticastDaemon(port);
|
||||
set { nativeConnectionFactory.SetMulticastDaemon(value); }
|
||||
}
|
||||
|
||||
public void SetMulticastEnabled(bool enabled)
|
||||
public bool MulticastEnabled
|
||||
{
|
||||
nativeConnectionFactory.SetMulticastEnabled(enabled);
|
||||
set { nativeConnectionFactory.SetMulticastEnabled(value); }
|
||||
}
|
||||
|
||||
public void SetReconnAttemptCount(int attempts)
|
||||
public int ReconnAttemptCount
|
||||
{
|
||||
nativeConnectionFactory.SetReconnAttemptCount(attempts);
|
||||
set { nativeConnectionFactory.SetReconnAttemptCount(value); }
|
||||
}
|
||||
|
||||
public void SetReconnAttemptDelay(int delay)
|
||||
public int ReconnAttemptDelay
|
||||
{
|
||||
nativeConnectionFactory.SetReconnAttemptDelay(delay);
|
||||
set { nativeConnectionFactory.SetReconnAttemptDelay(value); }
|
||||
}
|
||||
|
||||
public void SetReconnAttemptTimeout(int timeout)
|
||||
public int ReconnAttemptTimeout
|
||||
{
|
||||
nativeConnectionFactory.SetReconnAttemptTimeout(timeout);
|
||||
set { nativeConnectionFactory.SetReconnAttemptTimeout(value); }
|
||||
}
|
||||
|
||||
public void SetServerUrl(string serverUrl)
|
||||
public string ServerUrl
|
||||
{
|
||||
nativeConnectionFactory.SetServerUrl(serverUrl);
|
||||
set { nativeConnectionFactory.SetServerUrl(value); }
|
||||
}
|
||||
|
||||
public void SetSSLAuthOnly(bool authOnly)
|
||||
public bool SSLAuthOnly
|
||||
{
|
||||
nativeConnectionFactory.SetSSLAuthOnly(authOnly);
|
||||
set { nativeConnectionFactory.SetSSLAuthOnly(value); }
|
||||
}
|
||||
|
||||
public void SetSSLProxy(string host, int port)
|
||||
@@ -176,29 +176,29 @@ namespace Spring.Messaging.Ems.Common
|
||||
nativeConnectionFactory.SetSSLProxy(host, port);
|
||||
}
|
||||
|
||||
public void SetSSLProxyAuth(string username, string password)
|
||||
public string[] SSLProxyAuth
|
||||
{
|
||||
nativeConnectionFactory.SetSSLProxyAuth(username, password);
|
||||
set { nativeConnectionFactory.SetSSLProxyAuth(value[0], value[1]); }
|
||||
}
|
||||
|
||||
public void SetSSLTrace(bool trace)
|
||||
public bool SSLTrace
|
||||
{
|
||||
nativeConnectionFactory.SetSSLTrace(trace);
|
||||
set { nativeConnectionFactory.SetSSLTrace(value); }
|
||||
}
|
||||
|
||||
public void SetTargetHostName(string targetHostName)
|
||||
public string TargetHostName
|
||||
{
|
||||
nativeConnectionFactory.SetTargetHostName(targetHostName);
|
||||
set { nativeConnectionFactory.SetTargetHostName(value); }
|
||||
}
|
||||
|
||||
public void SetUserName(string username)
|
||||
public string UserName
|
||||
{
|
||||
nativeConnectionFactory.SetUserName(username);
|
||||
set { nativeConnectionFactory.SetUserName(value); }
|
||||
}
|
||||
|
||||
public void SetUserPassword(string password)
|
||||
public string UserPassword
|
||||
{
|
||||
nativeConnectionFactory.SetUserPassword(password);
|
||||
set { nativeConnectionFactory.SetUserPassword(value); }
|
||||
}
|
||||
|
||||
public FactoryLoadBalanceMetric Metric
|
||||
|
||||
@@ -31,33 +31,40 @@ namespace Spring.Messaging.Ems.Common
|
||||
|
||||
IConnection CreateConnection();
|
||||
IConnection CreateConnection(string userName, string password);
|
||||
object GetCertificateStore();
|
||||
string GetSSLProxyHost();
|
||||
string GetSSLProxyPassword();
|
||||
int GetSSLProxyPort();
|
||||
string GetSSLProxyUser();
|
||||
object CertificateStore { get; }
|
||||
string SSLProxyHost { get; }
|
||||
string SSLProxyPassword { get; }
|
||||
int SSLProxyPort { get; }
|
||||
string SSLProxyUser { get; }
|
||||
|
||||
void SetCertificateStoreType(EMSSSLStoreType type, object storeInfo);
|
||||
void SetClientID(string clientID);
|
||||
void SetClientTracer(StreamWriter tracer);
|
||||
void SetConnAttemptCount(int attempts);
|
||||
void SetConnAttemptDelay(int delay);
|
||||
void SetConnAttemptTimeout(int timeout);
|
||||
void SetHostNameVerifier(EMSSSLHostNameVerifier verifier);
|
||||
void SetMetric(int metric);
|
||||
void SetMulticastDaemon(string port);
|
||||
void SetMulticastEnabled(bool enabled);
|
||||
void SetReconnAttemptCount(int attempts);
|
||||
void SetReconnAttemptDelay(int delay);
|
||||
void SetReconnAttemptTimeout(int timeout);
|
||||
void SetServerUrl(string serverUrl);
|
||||
void SetSSLAuthOnly(bool authOnly);
|
||||
|
||||
string ClientID { set; }
|
||||
StreamWriter ClientTracer { set; }
|
||||
int ConnAttemptCount { set; }
|
||||
int ConnAttemptDelay { set; }
|
||||
int ConnAttemptTimeout { set; }
|
||||
EMSSSLHostNameVerifier HostNameVerifier { set; }
|
||||
|
||||
int MetricAsInt { set; }
|
||||
|
||||
|
||||
string MulticastDaemon { set; }
|
||||
bool MulticastEnabled { set; }
|
||||
int ReconnAttemptCount { set; }
|
||||
int ReconnAttemptDelay { set; }
|
||||
int ReconnAttemptTimeout { set; }
|
||||
string ServerUrl { set; }
|
||||
bool SSLAuthOnly { set; }
|
||||
|
||||
void SetSSLProxy(string host, int port);
|
||||
void SetSSLProxyAuth(string username, string password);
|
||||
void SetSSLTrace(bool trace);
|
||||
void SetTargetHostName(string targetHostName);
|
||||
void SetUserName(string username);
|
||||
void SetUserPassword(string password);
|
||||
|
||||
string[] SSLProxyAuth { set; }
|
||||
|
||||
bool SSLTrace { set; }
|
||||
string TargetHostName { set; }
|
||||
string UserName { set; }
|
||||
string UserPassword { set; }
|
||||
|
||||
string ToString();
|
||||
FactoryLoadBalanceMetric Metric { get; set; }
|
||||
|
||||
@@ -158,6 +158,7 @@ namespace Spring.Messaging.Ems.Connections
|
||||
/// <value>The exception listener.</value>
|
||||
public IExceptionListener ExceptionListener
|
||||
{
|
||||
get { return exceptionListener; }
|
||||
set { exceptionListener = value; }
|
||||
}
|
||||
|
||||
@@ -253,29 +254,29 @@ namespace Spring.Messaging.Ems.Connections
|
||||
get { return targetConnectionFactory.NativeConnectionFactory; }
|
||||
}
|
||||
|
||||
public object GetCertificateStore()
|
||||
public object CertificateStore
|
||||
{
|
||||
return TargetConnectionFactory.GetCertificateStore();
|
||||
get { return TargetConnectionFactory.CertificateStore; }
|
||||
}
|
||||
|
||||
public string GetSSLProxyHost()
|
||||
public string SSLProxyHost
|
||||
{
|
||||
return TargetConnectionFactory.GetSSLProxyHost();
|
||||
get { return TargetConnectionFactory.SSLProxyHost; }
|
||||
}
|
||||
|
||||
public string GetSSLProxyPassword()
|
||||
public string SSLProxyPassword
|
||||
{
|
||||
return TargetConnectionFactory.GetSSLProxyPassword();
|
||||
get { return TargetConnectionFactory.SSLProxyPassword; }
|
||||
}
|
||||
|
||||
public int GetSSLProxyPort()
|
||||
public int SSLProxyPort
|
||||
{
|
||||
return TargetConnectionFactory.GetSSLProxyPort();
|
||||
get { return TargetConnectionFactory.SSLProxyPort; }
|
||||
}
|
||||
|
||||
public string GetSSLProxyUser()
|
||||
public string SSLProxyUser
|
||||
{
|
||||
return TargetConnectionFactory.GetSSLProxyUser();
|
||||
get { return TargetConnectionFactory.SSLProxyUser; }
|
||||
}
|
||||
|
||||
public void SetCertificateStoreType(EMSSSLStoreType type, object storeInfo)
|
||||
@@ -283,75 +284,78 @@ namespace Spring.Messaging.Ems.Connections
|
||||
TargetConnectionFactory.SetCertificateStoreType(type, storeInfo);
|
||||
}
|
||||
|
||||
public void SetClientID(string clientID)
|
||||
public string ClientID
|
||||
{
|
||||
this.clientId = clientID;
|
||||
TargetConnectionFactory.SetClientID(clientID);
|
||||
set
|
||||
{
|
||||
this.clientId = value;
|
||||
TargetConnectionFactory.ClientID = value;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetClientTracer(StreamWriter tracer)
|
||||
public StreamWriter ClientTracer
|
||||
{
|
||||
TargetConnectionFactory.SetClientTracer(tracer);
|
||||
set { TargetConnectionFactory.ClientTracer = value; }
|
||||
}
|
||||
|
||||
public void SetConnAttemptCount(int attempts)
|
||||
public int ConnAttemptCount
|
||||
{
|
||||
TargetConnectionFactory.SetConnAttemptCount(attempts);
|
||||
set { TargetConnectionFactory.ConnAttemptCount = value; }
|
||||
}
|
||||
|
||||
public void SetConnAttemptDelay(int delay)
|
||||
public int ConnAttemptDelay
|
||||
{
|
||||
TargetConnectionFactory.SetConnAttemptDelay(delay);
|
||||
set { TargetConnectionFactory.ConnAttemptDelay = value; }
|
||||
}
|
||||
|
||||
public void SetConnAttemptTimeout(int timeout)
|
||||
public int ConnAttemptTimeout
|
||||
{
|
||||
TargetConnectionFactory.SetConnAttemptTimeout(timeout);
|
||||
set { TargetConnectionFactory.ConnAttemptTimeout = value; }
|
||||
}
|
||||
|
||||
public void SetHostNameVerifier(EMSSSLHostNameVerifier verifier)
|
||||
public EMSSSLHostNameVerifier HostNameVerifier
|
||||
{
|
||||
TargetConnectionFactory.SetHostNameVerifier(verifier);
|
||||
set { TargetConnectionFactory.HostNameVerifier = value; }
|
||||
}
|
||||
|
||||
public void SetMetric(int metric)
|
||||
public int MetricAsInt
|
||||
{
|
||||
TargetConnectionFactory.SetMetric(metric);
|
||||
set { TargetConnectionFactory.MetricAsInt = value; }
|
||||
}
|
||||
|
||||
public void SetMulticastDaemon(string port)
|
||||
public string MulticastDaemon
|
||||
{
|
||||
TargetConnectionFactory.SetMulticastDaemon(port);
|
||||
set { TargetConnectionFactory.MulticastDaemon = value; }
|
||||
}
|
||||
|
||||
public void SetMulticastEnabled(bool enabled)
|
||||
public bool MulticastEnabled
|
||||
{
|
||||
TargetConnectionFactory.SetMulticastEnabled(enabled);
|
||||
set { TargetConnectionFactory.MulticastEnabled = value; }
|
||||
}
|
||||
|
||||
public void SetReconnAttemptCount(int attempts)
|
||||
public int ReconnAttemptCount
|
||||
{
|
||||
TargetConnectionFactory.SetReconnAttemptCount(attempts);
|
||||
set { TargetConnectionFactory.ReconnAttemptCount = value; }
|
||||
}
|
||||
|
||||
public void SetReconnAttemptDelay(int delay)
|
||||
public int ReconnAttemptDelay
|
||||
{
|
||||
TargetConnectionFactory.SetReconnAttemptDelay(delay);
|
||||
set { TargetConnectionFactory.ReconnAttemptDelay = value; }
|
||||
}
|
||||
|
||||
public void SetReconnAttemptTimeout(int timeout)
|
||||
public int ReconnAttemptTimeout
|
||||
{
|
||||
TargetConnectionFactory.SetReconnAttemptTimeout(timeout);
|
||||
set { TargetConnectionFactory.ReconnAttemptTimeout = value; }
|
||||
}
|
||||
|
||||
public void SetServerUrl(string serverUrl)
|
||||
public string ServerUrl
|
||||
{
|
||||
TargetConnectionFactory.SetServerUrl(serverUrl);
|
||||
set { TargetConnectionFactory.ServerUrl = value; }
|
||||
}
|
||||
|
||||
public void SetSSLAuthOnly(bool authOnly)
|
||||
public bool SSLAuthOnly
|
||||
{
|
||||
TargetConnectionFactory.SetSSLAuthOnly(authOnly);
|
||||
set { TargetConnectionFactory.SSLAuthOnly = value; }
|
||||
}
|
||||
|
||||
public void SetSSLProxy(string host, int port)
|
||||
@@ -359,29 +363,29 @@ namespace Spring.Messaging.Ems.Connections
|
||||
TargetConnectionFactory.SetSSLProxy(host, port);
|
||||
}
|
||||
|
||||
public void SetSSLProxyAuth(string username, string password)
|
||||
public string[] SSLProxyAuth
|
||||
{
|
||||
TargetConnectionFactory.SetSSLProxyAuth(username, password);
|
||||
set { TargetConnectionFactory.SSLProxyAuth = value; }
|
||||
}
|
||||
|
||||
public void SetSSLTrace(bool trace)
|
||||
public bool SSLTrace
|
||||
{
|
||||
TargetConnectionFactory.SetSSLTrace(trace);
|
||||
set { TargetConnectionFactory.SSLTrace = value; }
|
||||
}
|
||||
|
||||
public void SetTargetHostName(string targetHostName)
|
||||
public string TargetHostName
|
||||
{
|
||||
TargetConnectionFactory.SetTargetHostName(targetHostName);
|
||||
set { TargetConnectionFactory.TargetHostName = value; }
|
||||
}
|
||||
|
||||
public void SetUserName(string username)
|
||||
public string UserName
|
||||
{
|
||||
TargetConnectionFactory.SetUserName(username);
|
||||
set { TargetConnectionFactory.UserName = value; }
|
||||
}
|
||||
|
||||
public void SetUserPassword(string password)
|
||||
public string UserPassword
|
||||
{
|
||||
TargetConnectionFactory.SetUserPassword(password);
|
||||
set { TargetConnectionFactory.UserPassword = value; }
|
||||
}
|
||||
|
||||
public FactoryLoadBalanceMetric Metric
|
||||
@@ -461,20 +465,13 @@ namespace Spring.Messaging.Ems.Connections
|
||||
}
|
||||
if (this.exceptionListener != null || this.reconnectOnException)
|
||||
{
|
||||
IExceptionListener listenertoUse = this.exceptionListener;
|
||||
|
||||
IExceptionListener listenerToUse = this.exceptionListener;
|
||||
if (reconnectOnException)
|
||||
{
|
||||
listenerToUse = new InternalChainedExceptionListener(this, listenerToUse);
|
||||
}
|
||||
con.ExceptionListener = listenerToUse;
|
||||
}
|
||||
/*
|
||||
if (reconnectOnException)
|
||||
{
|
||||
//add reconnect exception handler first to exception chain.
|
||||
|
||||
con.ExceptionListener += new ExceptionHandler(this.OnException);
|
||||
}
|
||||
if (ExceptionListener != null)
|
||||
{
|
||||
con.ExceptionListener += new ExceptionListener(ExceptionListener.OnException);
|
||||
}*/
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace Spring.Messaging.Ems.Listener.Adapter
|
||||
|
||||
private object defaultResponseDestination;
|
||||
|
||||
private DestinationResolver destinationResolver = new DynamicDestinationResolver();
|
||||
private IDestinationResolver destinationResolver = new DynamicDestinationResolver();
|
||||
|
||||
private IMessageConverter messageConverter;
|
||||
|
||||
@@ -182,7 +182,7 @@ namespace Spring.Messaging.Ems.Listener.Adapter
|
||||
/// Specify another implementation, for other strategies, perhaps from a directory service.</para>
|
||||
/// </summary>
|
||||
/// <value>The destination resolver.</value>
|
||||
public DestinationResolver DestinationResolver
|
||||
public IDestinationResolver DestinationResolver
|
||||
{
|
||||
get { return destinationResolver; }
|
||||
set
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Spring.Messaging.Ems.Support.Destinations
|
||||
///
|
||||
/// <author>Juergen Hoeller</author>
|
||||
/// <author>Mark Pollack (.NET)</author>
|
||||
public class DynamicDestinationResolver : DestinationResolver
|
||||
public class DynamicDestinationResolver : IDestinationResolver
|
||||
{
|
||||
/// <summary> Resolve the given destination name, either as located resource
|
||||
/// or as dynamic destination.
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Spring.Messaging.Ems.Support.Destinations
|
||||
{
|
||||
#region Fields
|
||||
|
||||
private DestinationResolver destinationResolver = new DynamicDestinationResolver();
|
||||
private IDestinationResolver destinationResolver = new DynamicDestinationResolver();
|
||||
|
||||
private bool pubSubDomain = false;
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace Spring.Messaging.Ems.Support.Destinations
|
||||
/// JndDestinationResolver for resolving destination names as JNDI locations.
|
||||
/// </remarks>
|
||||
/// <value>The destination resolver.</value>
|
||||
virtual public DestinationResolver DestinationResolver
|
||||
virtual public IDestinationResolver DestinationResolver
|
||||
{
|
||||
get
|
||||
{
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Spring.Messaging.Ems.Support.Destinations
|
||||
/// </remarks>
|
||||
/// <author>Juergen Hoeller</author>
|
||||
/// <author>Mark Pollack (.NET)</author>
|
||||
public interface DestinationResolver
|
||||
public interface IDestinationResolver
|
||||
{
|
||||
/// <summary> Resolve the given destination name, either as located resource
|
||||
/// or as dynamic destination.
|
||||
|
||||
135
src/Spring/Spring.Messaging.Ems/Spring.Messaging.Ems.2005.csproj
Normal file
135
src/Spring/Spring.Messaging.Ems/Spring.Messaging.Ems.2005.csproj
Normal file
@@ -0,0 +1,135 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{900E3839-301E-48B1-BAEB-B6645620ACFF}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Spring</RootNamespace>
|
||||
<AssemblyName>Spring.Messaging.Ems</AssemblyName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\..\build\VS.NET.2005\Spring.Messaging.Ems\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;NET_2_0</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DocumentationFile>..\..\..\build\VS.NET.2005\Spring.Messaging.Ems\Debug\Spring.Messaging.Ems.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\..\build\VS.NET.2005\Spring.Messaging.Ems\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NET_2_0</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="antlr.runtime, Version=2.7.6.2, Culture=neutral, PublicKeyToken=65e474d141e25e07, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\lib\Net\2.0\antlr.runtime.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Common.Logging, Version=1.1.0.2, Culture=neutral, PublicKeyToken=65e474d141e25e07, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\lib\net\2.0\Common.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.XML" />
|
||||
<Reference Include="TIBCO.EMS, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5b83db8ff05c64ba, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\lib\Net\2.0\TIBCO.EMS.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Spring.Aop\Spring.Aop.2005.csproj">
|
||||
<Project>{3A3A4E65-45A6-4B20-B460-0BEDC302C02C}</Project>
|
||||
<Name>Spring.Aop.2005</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Spring.Core\Spring.Core.2005.csproj">
|
||||
<Project>{710961A3-0DF4-49E4-A26E-F5B9C044AC84}</Project>
|
||||
<Name>Spring.Core.2005</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Spring.Data\Spring.Data.2005.csproj">
|
||||
<Project>{AE00E5AB-C39A-436F-86D2-33BFE33E2E40}</Project>
|
||||
<Name>Spring.Data.2005</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Messaging\Ems\Common\EmsConnection.cs" />
|
||||
<Compile Include="Messaging\Ems\Common\EmsConnectionFactory.cs" />
|
||||
<Compile Include="Messaging\Ems\Common\EmsMessageConsumer.cs" />
|
||||
<Compile Include="Messaging\Ems\Common\EmsMessageProducer.cs" />
|
||||
<Compile Include="Messaging\Ems\Common\EmsSession.cs" />
|
||||
<Compile Include="Messaging\Ems\Common\EmsTopicSubscriber.cs" />
|
||||
<Compile Include="Messaging\Ems\Common\IConnection.cs" />
|
||||
<Compile Include="Messaging\Ems\Common\IConnectionFactory.cs" />
|
||||
<Compile Include="Messaging\Ems\Common\IMessageConsumer.cs" />
|
||||
<Compile Include="Messaging\Ems\Common\IMessageProducer.cs" />
|
||||
<Compile Include="Messaging\Ems\Common\ISession.cs" />
|
||||
<Compile Include="Messaging\Ems\Common\ITopicSubscriber.cs" />
|
||||
<Compile Include="Messaging\Ems\Config\MessageListenerContainerObjectDefinitionParser.cs" />
|
||||
<Compile Include="Messaging\Ems\Config\EmsNamespaceParser.cs" />
|
||||
<Compile Include="Messaging\Ems\Connections\CachedMessageConsumer .cs" />
|
||||
<Compile Include="Messaging\Ems\Connections\CachedMessageProducer.cs" />
|
||||
<Compile Include="Messaging\Ems\Connections\CachedSession.cs" />
|
||||
<Compile Include="Messaging\Ems\Connections\CachingConnectionFactory.cs" />
|
||||
<Compile Include="Messaging\Ems\Connections\ChainedExceptionListener.cs" />
|
||||
<Compile Include="Messaging\Ems\Connections\ConnectionFactoryUtils.cs" />
|
||||
<Compile Include="Messaging\Ems\Connections\EmsResourceHolder.cs" />
|
||||
<Compile Include="Messaging\Ems\Connections\EmsTransactionManager.cs" />
|
||||
<Compile Include="Messaging\Ems\Connections\IDecoratorSession.cs" />
|
||||
<Compile Include="Messaging\Ems\Connections\ISmartConnectionFactory.cs" />
|
||||
<Compile Include="Messaging\Ems\Connections\SingleConnectionFactory.cs" />
|
||||
<Compile Include="Messaging\Ems\Connections\SynchedLocalTransactionFailedException.cs" />
|
||||
<Compile Include="Messaging\Ems\Core\BrowserDelegate.cs" />
|
||||
<Compile Include="Messaging\Ems\Core\EmsGatewaySupport.cs" />
|
||||
<Compile Include="Messaging\Ems\Core\EmsTemplate.cs" />
|
||||
<Compile Include="Messaging\Ems\Core\IBrowserCallback.cs" />
|
||||
<Compile Include="Messaging\Ems\Core\IEmsOperations.cs" />
|
||||
<Compile Include="Messaging\Ems\Core\IMessageCreator.cs" />
|
||||
<Compile Include="Messaging\Ems\Core\IMessagePostProcessor.cs" />
|
||||
<Compile Include="Messaging\Ems\Core\IProducerCallback.cs" />
|
||||
<Compile Include="Messaging\Ems\Core\ISessionCallback.cs" />
|
||||
<Compile Include="Messaging\Ems\Core\MessageCreatorDelegate.cs" />
|
||||
<Compile Include="Messaging\Ems\Core\MessagePostProcessorDelegate.cs" />
|
||||
<Compile Include="Messaging\Ems\Core\ProducerDelegate.cs" />
|
||||
<Compile Include="Messaging\Ems\Core\SessionDelegate.cs" />
|
||||
<Compile Include="Messaging\Ems\Listener\AbstractListenerContainer.cs" />
|
||||
<Compile Include="Messaging\Ems\Listener\AbstractMessageListenerContainer.cs" />
|
||||
<Compile Include="Messaging\Ems\Listener\Adapter\ListenerExecutionFailedException.cs" />
|
||||
<Compile Include="Messaging\Ems\Listener\Adapter\MessageListenerAdapter.cs" />
|
||||
<Compile Include="Messaging\Ems\Listener\ISessionAwareMessageListener.cs" />
|
||||
<Compile Include="Messaging\Ems\Listener\LocallyExposedEmsResourceHolder.cs" />
|
||||
<Compile Include="Messaging\Ems\Listener\RecoveryTimeExceededException.cs" />
|
||||
<Compile Include="Messaging\Ems\Listener\SimpleMessageListenerContainer.cs" />
|
||||
<Compile Include="Messaging\Ems\Support\Converter\IMessageConverter.cs" />
|
||||
<Compile Include="Messaging\Ems\Support\Converter\ITypeMapper.cs" />
|
||||
<Compile Include="Messaging\Ems\Support\Converter\MessageConversionException.cs" />
|
||||
<Compile Include="Messaging\Ems\Support\Converter\SimpleMessageConverter.cs" />
|
||||
<Compile Include="Messaging\Ems\Support\Converter\TypeMapper.cs" />
|
||||
<Compile Include="Messaging\Ems\Support\Converter\XmlMessageConverter.cs" />
|
||||
<Compile Include="Messaging\Ems\Support\Destinations\DynamicDestinationResolver.cs" />
|
||||
<Compile Include="Messaging\Ems\Support\Destinations\IDestinationResolver.cs" />
|
||||
<Compile Include="Messaging\Ems\Support\Destinations\EmsDestinationAccessor.cs" />
|
||||
<Compile Include="Messaging\Ems\Support\EmsAccessor.cs" />
|
||||
<Compile Include="Messaging\Ems\Support\EmsUtils.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Messaging\Ems\Config\spring-ems-1.2.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
187
src/Spring/Spring.Messaging.Ems/Spring.Messaging.Ems.2008.csproj
Normal file
187
src/Spring/Spring.Messaging.Ems/Spring.Messaging.Ems.2008.csproj
Normal file
@@ -0,0 +1,187 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{900E3839-301E-48B1-BAEB-B6645620ACFF}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Spring</RootNamespace>
|
||||
<AssemblyName>Spring.Messaging.Ems</AssemblyName>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<OldToolsVersion>2.0</OldToolsVersion>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<PublishUrl>http://localhost/Spring.Messaging.Ems/</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Web</InstallFrom>
|
||||
<UpdateEnabled>true</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>true</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\..\build\VS.NET.2005\Spring.Messaging.Ems\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;NET_2_0</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DocumentationFile>..\..\..\build\VS.NET.2005\Spring.Messaging.Ems\Debug\Spring.Messaging.Ems.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\..\build\VS.NET.2005\Spring.Messaging.Ems\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NET_2_0</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="antlr.runtime, Version=2.7.6.2, Culture=neutral, PublicKeyToken=65e474d141e25e07, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\lib\Net\2.0\antlr.runtime.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Common.Logging, Version=1.1.0.2, Culture=neutral, PublicKeyToken=65e474d141e25e07, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\lib\net\2.0\Common.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.XML" />
|
||||
<Reference Include="TIBCO.EMS, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5b83db8ff05c64ba, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\lib\Net\2.0\TIBCO.EMS.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\CommonAssemblyInfo.cs">
|
||||
<Link>CommonAssemblyInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="AssemblyInfo.cs" />
|
||||
<Compile Include="Messaging\Ems\Common\CertificateStoreConfig.cs" />
|
||||
<Compile Include="Messaging\Ems\Common\EmsConnection.cs" />
|
||||
<Compile Include="Messaging\Ems\Common\EmsConnectionFactory.cs" />
|
||||
<Compile Include="Messaging\Ems\Common\EmsMessageConsumer.cs" />
|
||||
<Compile Include="Messaging\Ems\Common\EmsMessageProducer.cs" />
|
||||
<Compile Include="Messaging\Ems\Common\EmsSession.cs" />
|
||||
<Compile Include="Messaging\Ems\Common\EmsTopicSubscriber.cs" />
|
||||
<Compile Include="Messaging\Ems\Common\IConnection.cs" />
|
||||
<Compile Include="Messaging\Ems\Common\IConnectionFactory.cs" />
|
||||
<Compile Include="Messaging\Ems\Common\IMessageConsumer.cs" />
|
||||
<Compile Include="Messaging\Ems\Common\IMessageProducer.cs" />
|
||||
<Compile Include="Messaging\Ems\Common\ISession.cs" />
|
||||
<Compile Include="Messaging\Ems\Common\ITopicSubscriber.cs" />
|
||||
<Compile Include="Messaging\Ems\Config\MessageListenerContainerObjectDefinitionParser.cs" />
|
||||
<Compile Include="Messaging\Ems\Config\EmsNamespaceParser.cs" />
|
||||
<Compile Include="Messaging\Ems\Connections\CachedMessageConsumer .cs" />
|
||||
<Compile Include="Messaging\Ems\Connections\CachedMessageProducer.cs" />
|
||||
<Compile Include="Messaging\Ems\Connections\CachedSession.cs" />
|
||||
<Compile Include="Messaging\Ems\Connections\CachingConnectionFactory.cs" />
|
||||
<Compile Include="Messaging\Ems\Connections\ChainedExceptionListener.cs" />
|
||||
<Compile Include="Messaging\Ems\Connections\ConnectionFactoryUtils.cs" />
|
||||
<Compile Include="Messaging\Ems\Connections\EmsResourceHolder.cs" />
|
||||
<Compile Include="Messaging\Ems\Connections\EmsTransactionManager.cs" />
|
||||
<Compile Include="Messaging\Ems\Connections\IDecoratorSession.cs" />
|
||||
<Compile Include="Messaging\Ems\Connections\ISmartConnectionFactory.cs" />
|
||||
<Compile Include="Messaging\Ems\Connections\SingleConnectionFactory.cs" />
|
||||
<Compile Include="Messaging\Ems\Connections\SynchedLocalTransactionFailedException.cs" />
|
||||
<Compile Include="Messaging\Ems\Core\BrowserDelegate.cs" />
|
||||
<Compile Include="Messaging\Ems\Core\EmsGatewaySupport.cs" />
|
||||
<Compile Include="Messaging\Ems\Core\EmsTemplate.cs" />
|
||||
<Compile Include="Messaging\Ems\Core\IBrowserCallback.cs" />
|
||||
<Compile Include="Messaging\Ems\Core\IEmsOperations.cs" />
|
||||
<Compile Include="Messaging\Ems\Core\IMessageCreator.cs" />
|
||||
<Compile Include="Messaging\Ems\Core\IMessagePostProcessor.cs" />
|
||||
<Compile Include="Messaging\Ems\Core\IProducerCallback.cs" />
|
||||
<Compile Include="Messaging\Ems\Core\ISessionCallback.cs" />
|
||||
<Compile Include="Messaging\Ems\Core\MessageCreatorDelegate.cs" />
|
||||
<Compile Include="Messaging\Ems\Core\MessagePostProcessorDelegate.cs" />
|
||||
<Compile Include="Messaging\Ems\Core\ProducerDelegate.cs" />
|
||||
<Compile Include="Messaging\Ems\Core\SessionDelegate.cs" />
|
||||
<Compile Include="Messaging\Ems\Listener\AbstractListenerContainer.cs" />
|
||||
<Compile Include="Messaging\Ems\Listener\AbstractMessageListenerContainer.cs" />
|
||||
<Compile Include="Messaging\Ems\Listener\Adapter\ListenerExecutionFailedException.cs" />
|
||||
<Compile Include="Messaging\Ems\Listener\Adapter\MessageListenerAdapter.cs" />
|
||||
<Compile Include="Messaging\Ems\Listener\ISessionAwareMessageListener.cs" />
|
||||
<Compile Include="Messaging\Ems\Listener\LocallyExposedEmsResourceHolder.cs" />
|
||||
<Compile Include="Messaging\Ems\Listener\RecoveryTimeExceededException.cs" />
|
||||
<Compile Include="Messaging\Ems\Listener\SimpleMessageListenerContainer.cs" />
|
||||
<Compile Include="Messaging\Ems\Support\Converter\IMessageConverter.cs" />
|
||||
<Compile Include="Messaging\Ems\Support\Converter\ITypeMapper.cs" />
|
||||
<Compile Include="Messaging\Ems\Support\Converter\MessageConversionException.cs" />
|
||||
<Compile Include="Messaging\Ems\Support\Converter\SimpleMessageConverter.cs" />
|
||||
<Compile Include="Messaging\Ems\Support\Converter\TypeMapper.cs" />
|
||||
<Compile Include="Messaging\Ems\Support\Converter\XmlMessageConverter.cs" />
|
||||
<Compile Include="Messaging\Ems\Support\Destinations\DynamicDestinationResolver.cs" />
|
||||
<Compile Include="Messaging\Ems\Support\Destinations\IDestinationResolver.cs" />
|
||||
<Compile Include="Messaging\Ems\Support\Destinations\EmsDestinationAccessor.cs" />
|
||||
<Compile Include="Messaging\Ems\Support\EmsAccessor.cs" />
|
||||
<Compile Include="Messaging\Ems\Support\EmsUtils.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Messaging\Ems\Config\spring-ems-1.2.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework Client Profile</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 2.0 %28x86%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.0 %28x86%29</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Spring.Aop\Spring.Aop.2008.csproj">
|
||||
<Project>{3A3A4E65-45A6-4B20-B460-0BEDC302C02C}</Project>
|
||||
<Name>Spring.Aop.2008</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Spring.Core\Spring.Core.2008.csproj">
|
||||
<Project>{710961A3-0DF4-49E4-A26E-F5B9C044AC84}</Project>
|
||||
<Name>Spring.Core.2008</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Spring.Data\Spring.Data.2008.csproj">
|
||||
<Project>{AE00E5AB-C39A-436F-86D2-33BFE33E2E40}</Project>
|
||||
<Name>Spring.Data.2008</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
4
src/Spring/Spring.Messaging.Nms/AssemblyInfo.cs
Normal file
4
src/Spring/Spring.Messaging.Nms/AssemblyInfo.cs
Normal file
@@ -0,0 +1,4 @@
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyTitle("Spring.Messaging.Nms")]
|
||||
[assembly: AssemblyDescription("ActiveMQ support")]
|
||||
@@ -2,7 +2,7 @@
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.21022</ProductVersion>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{AEB1578C-9018-4D49-B440-789F38DD2F29}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
@@ -48,6 +48,10 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\CommonAssemblyInfo.cs">
|
||||
<Link>CommonAssemblyInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="AssemblyInfo.cs" />
|
||||
<Compile Include="Messaging\Nms\Config\MessageListenerContainerObjectDefinitionParser.cs" />
|
||||
<Compile Include="Messaging\Nms\Config\NmsNamespaceParser.cs" />
|
||||
<Compile Include="Messaging\Nms\Connections\CachedMessageConsumer .cs" />
|
||||
|
||||
5
test/Spring/Spring.Messaging.Ems.Tests/AssemblyInfo.cs
Normal file
5
test/Spring/Spring.Messaging.Ems.Tests/AssemblyInfo.cs
Normal file
@@ -0,0 +1,5 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
[assembly: AssemblyTitle("Spring.Messaging.Ems Tests")]
|
||||
[assembly: AssemblyDescription("Unit tests for Spring.Messaging.Ems assembly")]
|
||||
@@ -0,0 +1,271 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright <20> 2002-2007 the original author or authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
#region Imports
|
||||
|
||||
using NUnit.Framework;
|
||||
using Rhino.Mocks;
|
||||
using Spring.Messaging.Ems.Common;
|
||||
using Spring.Messaging.Nms.Connections;
|
||||
using TIBCO.EMS;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Spring.Messaging.Ems.Connections
|
||||
{
|
||||
/// <summary>
|
||||
/// This class contains tests for CachingConnectionFactory
|
||||
/// </summary>
|
||||
/// <author>Mark Pollack</author>
|
||||
[TestFixture]
|
||||
public class CachingConnectionFactoryTests
|
||||
{
|
||||
private MockRepository mocks;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
mocks = new MockRepository();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CachedSession()
|
||||
{
|
||||
IConnectionFactory connectionFactory = (IConnectionFactory)mocks.CreateMock(typeof(IConnectionFactory));
|
||||
IConnection connection = new TestConnection();
|
||||
|
||||
Expect.Call(connectionFactory.CreateConnection()).Return(connection).Repeat.Once();
|
||||
|
||||
mocks.ReplayAll();
|
||||
|
||||
CachingConnectionFactory cachingConnectionFactory = new CachingConnectionFactory();
|
||||
cachingConnectionFactory.TargetConnectionFactory = connectionFactory;
|
||||
|
||||
IConnection con1 = cachingConnectionFactory.CreateConnection();
|
||||
|
||||
ISession session1 = con1.CreateSession(true, SessionMode.SessionTransacted);
|
||||
TestSession testSession = GetTestSession(session1);
|
||||
Assert.AreEqual(1, testSession.CreatedCount);
|
||||
Assert.AreEqual(0, testSession.CloseCount);
|
||||
|
||||
|
||||
session1.Close(); // won't close, will put in session cache.
|
||||
Assert.AreEqual(0, testSession.CloseCount);
|
||||
|
||||
ISession session2 = con1.CreateSession(true, SessionMode.SessionTransacted);
|
||||
|
||||
|
||||
TestSession testSession2 = GetTestSession(session2);
|
||||
|
||||
|
||||
Assert.AreSame(testSession, testSession2);
|
||||
|
||||
Assert.AreEqual(1, testSession.CreatedCount);
|
||||
Assert.AreEqual(0, testSession.CloseCount);
|
||||
|
||||
mocks.VerifyAll();
|
||||
|
||||
//don't explicitly call close on
|
||||
}
|
||||
|
||||
private static TestSession GetTestSession(ISession session1)
|
||||
{
|
||||
CachedSession cachedSession = session1 as CachedSession;
|
||||
Assert.IsNotNull(cachedSession);
|
||||
TestSession testSession = cachedSession.TargetSession as TestSession;
|
||||
Assert.IsNotNull(testSession);
|
||||
return testSession;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CachedSessionTwoRequests()
|
||||
{
|
||||
IConnectionFactory connectionFactory = (IConnectionFactory)mocks.CreateMock(typeof(IConnectionFactory));
|
||||
IConnection connection = new TestConnection();
|
||||
|
||||
Expect.Call(connectionFactory.CreateConnection()).Return(connection).Repeat.Once();
|
||||
|
||||
mocks.ReplayAll();
|
||||
|
||||
CachingConnectionFactory cachingConnectionFactory = new CachingConnectionFactory();
|
||||
cachingConnectionFactory.TargetConnectionFactory = connectionFactory;
|
||||
IConnection con1 = cachingConnectionFactory.CreateConnection();
|
||||
|
||||
ISession session1 = con1.CreateSession(true, SessionMode.SessionTransacted);
|
||||
TestSession testSession1 = GetTestSession(session1);
|
||||
Assert.AreEqual(1, testSession1.CreatedCount);
|
||||
Assert.AreEqual(0, testSession1.CloseCount);
|
||||
|
||||
|
||||
//will create a new one, not in the cache.
|
||||
ISession session2 = con1.CreateSession(true, SessionMode.SessionTransacted);
|
||||
TestSession testSession2 = GetTestSession(session2);
|
||||
Assert.AreEqual(1, testSession2.CreatedCount);
|
||||
Assert.AreEqual(0, testSession2.CloseCount);
|
||||
|
||||
Assert.AreNotSame(testSession1, testSession2);
|
||||
|
||||
Assert.AreNotSame(session1, session2);
|
||||
|
||||
session1.Close(); // will be put in the cache
|
||||
|
||||
ISession session3 = con1.CreateSession(true, SessionMode.SessionTransacted);
|
||||
TestSession testSession3 = GetTestSession(session3);
|
||||
Assert.AreSame(testSession1, testSession3);
|
||||
Assert.AreSame(session1, session3);
|
||||
Assert.AreEqual(1, testSession1.CreatedCount);
|
||||
Assert.AreEqual(0, testSession1.CloseCount);
|
||||
|
||||
mocks.VerifyAll();
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests that the same underlying instance of the message producer is returned after
|
||||
/// creating a session, creating the producer (A), closing the session, and creating another
|
||||
/// producer (B). Assert that (A)=(B).
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void CachedMessageProducer()
|
||||
{
|
||||
IConnectionFactory connectionFactory = (IConnectionFactory)mocks.CreateMock(typeof(IConnectionFactory));
|
||||
IConnection connection = new TestConnection();
|
||||
|
||||
Expect.Call(connectionFactory.CreateConnection()).Return(connection).Repeat.Once();
|
||||
|
||||
mocks.ReplayAll();
|
||||
|
||||
|
||||
CachingConnectionFactory cachingConnectionFactory = new CachingConnectionFactory();
|
||||
cachingConnectionFactory.TargetConnectionFactory = connectionFactory;
|
||||
IConnection con1 = cachingConnectionFactory.CreateConnection();
|
||||
|
||||
ISession sessionA = con1.CreateSession(true, SessionMode.SessionTransacted);
|
||||
Topic dest = new Topic("test.topic");
|
||||
IMessageProducer producerA = sessionA.CreateProducer(dest);
|
||||
TestMessageProducer tmpA = GetTestMessageProducer(producerA);
|
||||
|
||||
sessionA.Close();
|
||||
|
||||
ISession sessionB = con1.CreateSession(true, SessionMode.SessionTransacted);
|
||||
IMessageProducer producerB = sessionB.CreateProducer(dest);
|
||||
TestMessageProducer tmpB = GetTestMessageProducer(producerB);
|
||||
|
||||
Assert.AreSame(tmpA, tmpB);
|
||||
|
||||
mocks.VerifyAll();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CachedMessageProducerTwoRequests()
|
||||
{
|
||||
IConnectionFactory connectionFactory = (IConnectionFactory)mocks.CreateMock(typeof(IConnectionFactory));
|
||||
IConnection connection = new TestConnection();
|
||||
|
||||
Expect.Call(connectionFactory.CreateConnection()).Return(connection).Repeat.Once();
|
||||
|
||||
mocks.ReplayAll();
|
||||
|
||||
|
||||
CachingConnectionFactory cachingConnectionFactory = new CachingConnectionFactory();
|
||||
cachingConnectionFactory.TargetConnectionFactory = connectionFactory;
|
||||
IConnection con1 = cachingConnectionFactory.CreateConnection();
|
||||
|
||||
ISession sessionA = con1.CreateSession(true, SessionMode.SessionTransacted);
|
||||
Topic dest = new Topic("test.topic");
|
||||
IMessageProducer producerA = sessionA.CreateProducer(dest);
|
||||
TestMessageProducer tmpA = GetTestMessageProducer(producerA);
|
||||
|
||||
|
||||
ISession sessionB = con1.CreateSession(true, SessionMode.SessionTransacted);
|
||||
IMessageProducer producerB = sessionB.CreateProducer(dest);
|
||||
TestMessageProducer tmpB = GetTestMessageProducer(producerB);
|
||||
|
||||
Assert.AreNotSame(tmpA, tmpB);
|
||||
|
||||
sessionA.Close();
|
||||
|
||||
ISession sessionC = con1.CreateSession(true, SessionMode.SessionTransacted);
|
||||
IMessageProducer producerC = sessionC.CreateProducer(dest);
|
||||
TestMessageProducer tmpC = GetTestMessageProducer(producerC);
|
||||
|
||||
Assert.AreSame(tmpA, tmpC);
|
||||
|
||||
mocks.VerifyAll();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Tests that the same underlying instance of the message consumer is returned after
|
||||
/// creating a session, creating the consumer (A), closing the session, and creating another
|
||||
/// consumer (B). Assert that (A)=(B).
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void CachedMessageConsumer()
|
||||
{
|
||||
IConnectionFactory connectionFactory = (IConnectionFactory)mocks.CreateMock(typeof(IConnectionFactory));
|
||||
IConnection connection = new TestConnection();
|
||||
|
||||
|
||||
Expect.Call(connectionFactory.CreateConnection()).Return(connection).Repeat.Once();
|
||||
|
||||
mocks.ReplayAll();
|
||||
|
||||
|
||||
CachingConnectionFactory cachingConnectionFactory = new CachingConnectionFactory();
|
||||
cachingConnectionFactory.TargetConnectionFactory = connectionFactory;
|
||||
IConnection con1 = cachingConnectionFactory.CreateConnection();
|
||||
|
||||
ISession sessionA = con1.CreateSession(true, SessionMode.SessionTransacted);
|
||||
Destination destination = new Topic("test.dest");
|
||||
IMessageConsumer consumerA = sessionA.CreateConsumer(destination);
|
||||
TestMessageConsumer tmpA = GetTestMessageConsumer(consumerA);
|
||||
|
||||
sessionA.Close();
|
||||
|
||||
ISession sessionB = con1.CreateSession(true, SessionMode.SessionTransacted);
|
||||
IMessageConsumer consumerB = sessionB.CreateConsumer(destination);
|
||||
TestMessageConsumer tmpB = GetTestMessageConsumer(consumerB);
|
||||
|
||||
Assert.AreSame(tmpA, tmpB);
|
||||
|
||||
mocks.VerifyAll();
|
||||
}
|
||||
|
||||
private static TestMessageConsumer GetTestMessageConsumer(IMessageConsumer consumer)
|
||||
{
|
||||
CachedMessageConsumer cmp1 = consumer as CachedMessageConsumer;
|
||||
Assert.IsNotNull(cmp1);
|
||||
TestMessageConsumer tmp1 = cmp1.Target as TestMessageConsumer;
|
||||
Assert.IsNotNull(tmp1);
|
||||
return tmp1;
|
||||
}
|
||||
|
||||
private static TestMessageProducer GetTestMessageProducer(IMessageProducer producer1)
|
||||
{
|
||||
CachedMessageProducer cmp1 = producer1 as CachedMessageProducer;
|
||||
Assert.IsNotNull(cmp1);
|
||||
TestMessageProducer tmp1 = cmp1.Target as TestMessageProducer;
|
||||
Assert.IsNotNull(tmp1);
|
||||
return tmp1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,337 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright <20> 2002-2007 the original author or authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
#region Imports
|
||||
|
||||
|
||||
using NUnit.Framework;
|
||||
using Rhino.Mocks;
|
||||
using Spring.Messaging.Ems.Common;
|
||||
using Spring.Messaging.Ems.Core;
|
||||
using Spring.Transaction;
|
||||
using Spring.Transaction.Support;
|
||||
using TIBCO.EMS;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Spring.Messaging.Ems.Connections
|
||||
{
|
||||
/// <summary>
|
||||
/// This class contains tests for EmsTransactionManager
|
||||
/// </summary>
|
||||
/// <author>Mark Pollack</author>
|
||||
[TestFixture]
|
||||
public class EmsTransactionManagerTests
|
||||
{
|
||||
private MockRepository mocks;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
mocks = new MockRepository();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TransactionCommit()
|
||||
{
|
||||
IConnectionFactory connectionFactory = (IConnectionFactory) mocks.CreateMock(typeof (IConnectionFactory));
|
||||
IConnection connection = (IConnection) mocks.CreateMock(typeof (IConnection));
|
||||
ISession session = (ISession) mocks.CreateMock(typeof (ISession));
|
||||
|
||||
using (mocks.Ordered())
|
||||
{
|
||||
SetupCommitExpectations(connection, connectionFactory, session);
|
||||
}
|
||||
|
||||
mocks.ReplayAll();
|
||||
|
||||
EmsTransactionManager tm = new EmsTransactionManager(connectionFactory);
|
||||
ITransactionStatus ts = tm.GetTransaction(new DefaultTransactionDefinition());
|
||||
EmsTemplate nt = new EmsTemplate(connectionFactory);
|
||||
nt.Execute(new AssertSessionCallback(session));
|
||||
tm.Commit(ts);
|
||||
|
||||
mocks.VerifyAll();
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TransactionRollback()
|
||||
{
|
||||
IConnectionFactory connectionFactory = (IConnectionFactory) mocks.CreateMock(typeof (IConnectionFactory));
|
||||
IConnection connection = (IConnection) mocks.CreateMock(typeof (IConnection));
|
||||
ISession session = (ISession) mocks.CreateMock(typeof (ISession));
|
||||
|
||||
SetupRollbackExpectations(connection, connectionFactory, session);
|
||||
|
||||
mocks.ReplayAll();
|
||||
|
||||
EmsTransactionManager tm = new EmsTransactionManager(connectionFactory);
|
||||
ITransactionStatus ts = tm.GetTransaction(new DefaultTransactionDefinition());
|
||||
EmsTemplate nt = new EmsTemplate(connectionFactory);
|
||||
nt.Execute(new AssertSessionCallback(session));
|
||||
tm.Rollback(ts);
|
||||
|
||||
mocks.VerifyAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO because using anonymous delegates - refactor to support .net 1.1 later.
|
||||
*/
|
||||
#if NET_2_0
|
||||
[Test]
|
||||
public void ParticipatingTransactionWithCommit()
|
||||
{
|
||||
IConnectionFactory connectionFactory = (IConnectionFactory)mocks.CreateMock(typeof(IConnectionFactory));
|
||||
IConnection connection = (IConnection)mocks.CreateMock(typeof(IConnection));
|
||||
ISession session = (ISession)mocks.CreateMock(typeof(ISession));
|
||||
|
||||
using (mocks.Ordered())
|
||||
{
|
||||
SetupCommitExpectations(connection, connectionFactory, session);
|
||||
}
|
||||
|
||||
mocks.ReplayAll();
|
||||
|
||||
|
||||
EmsTransactionManager tm = new EmsTransactionManager(connectionFactory);
|
||||
ITransactionStatus ts = tm.GetTransaction(new DefaultTransactionDefinition());
|
||||
EmsTemplate nt = new EmsTemplate(connectionFactory);
|
||||
nt.Execute(new AssertSessionCallback(session));
|
||||
|
||||
TransactionTemplate tt = new TransactionTemplate(tm);
|
||||
tt.Execute(delegate(ITransactionStatus status)
|
||||
{
|
||||
nt.Execute(new AssertSessionCallback(session));
|
||||
return null;
|
||||
});
|
||||
|
||||
tm.Commit(ts);
|
||||
|
||||
mocks.VerifyAll();
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ParticipatingTransactionWithRollback()
|
||||
{
|
||||
IConnectionFactory connectionFactory = (IConnectionFactory) mocks.CreateMock(typeof (IConnectionFactory));
|
||||
IConnection connection = (IConnection) mocks.CreateMock(typeof (IConnection));
|
||||
ISession session = (ISession) mocks.CreateMock(typeof (ISession));
|
||||
|
||||
using (mocks.Ordered())
|
||||
{
|
||||
SetupRollbackExpectations(connection, connectionFactory, session);
|
||||
}
|
||||
|
||||
mocks.ReplayAll();
|
||||
|
||||
EmsTransactionManager tm = new EmsTransactionManager(connectionFactory);
|
||||
ITransactionStatus ts = tm.GetTransaction(new DefaultTransactionDefinition());
|
||||
EmsTemplate nt = new EmsTemplate(connectionFactory);
|
||||
nt.Execute(new AssertSessionCallback(session));
|
||||
|
||||
TransactionTemplate tt = new TransactionTemplate(tm);
|
||||
tt.Execute(delegate(ITransactionStatus status)
|
||||
{
|
||||
nt.Execute(new AssertSessionCallback(session));
|
||||
status.SetRollbackOnly();
|
||||
return null;
|
||||
});
|
||||
try
|
||||
{
|
||||
tm.Commit(ts);
|
||||
Assert.Fail("Should have thrown UnexpectedRollbackException");
|
||||
} catch (UnexpectedRollbackException)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
mocks.VerifyAll();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SuspendedTransaction()
|
||||
{
|
||||
IConnectionFactory connectionFactory = (IConnectionFactory) mocks.CreateMock(typeof (IConnectionFactory));
|
||||
IConnection connection = (IConnection) mocks.CreateMock(typeof (IConnection));
|
||||
ISession session = (ISession) mocks.CreateMock(typeof (ISession));
|
||||
ISession session2 = (ISession)mocks.CreateMock(typeof(ISession));
|
||||
|
||||
Expect.Call(connectionFactory.CreateConnection()).Return(connection).Repeat.Twice();
|
||||
Expect.Call(connection.CreateSession(true, Session.SESSION_TRANSACTED)).Return(session).Repeat.Once();
|
||||
Expect.Call(connection.CreateSession(false, Session.AUTO_ACKNOWLEDGE)).Return(session2).Repeat.Once();
|
||||
|
||||
session.Commit();
|
||||
LastCall.On(session).Repeat.Once();
|
||||
session.Close();
|
||||
LastCall.On(session).Repeat.Once();
|
||||
|
||||
session2.Close();
|
||||
LastCall.On(session2).Repeat.Once();
|
||||
|
||||
connection.Close();
|
||||
LastCall.On(connection).Repeat.Twice();
|
||||
|
||||
mocks.ReplayAll();
|
||||
|
||||
EmsTransactionManager tm = new EmsTransactionManager(connectionFactory);
|
||||
ITransactionStatus ts = tm.GetTransaction(new DefaultTransactionDefinition());
|
||||
EmsTemplate nt = new EmsTemplate(connectionFactory);
|
||||
nt.Execute(new AssertSessionCallback(session));
|
||||
|
||||
TransactionTemplate tt = new TransactionTemplate(tm);
|
||||
tt.PropagationBehavior = TransactionPropagation.NotSupported;
|
||||
tt.Execute(delegate(ITransactionStatus status)
|
||||
{
|
||||
nt.Execute(new AssertNotSameSessionCallback(session));
|
||||
return null;
|
||||
});
|
||||
|
||||
nt.Execute(new AssertSessionCallback(session));
|
||||
|
||||
tm.Commit(ts);
|
||||
|
||||
mocks.VerifyAll();
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TransactionSuspension()
|
||||
{
|
||||
IConnectionFactory connectionFactory = (IConnectionFactory)mocks.CreateMock(typeof(IConnectionFactory));
|
||||
IConnection connection = (IConnection)mocks.CreateMock(typeof(IConnection));
|
||||
ISession session = (ISession)mocks.CreateMock(typeof(ISession));
|
||||
ISession session2 = (ISession)mocks.CreateMock(typeof(ISession));
|
||||
|
||||
|
||||
Expect.Call(connectionFactory.CreateConnection()).Return(connection).Repeat.Twice();
|
||||
Expect.Call(connection.CreateSession(true, Session.SESSION_TRANSACTED)).Return(session).Repeat.Once();
|
||||
Expect.Call(connection.CreateSession(true, Session.SESSION_TRANSACTED)).Return(session2).Repeat.Once();
|
||||
|
||||
session.Commit();
|
||||
LastCall.On(session).Repeat.Once();
|
||||
session2.Commit();
|
||||
LastCall.On(session2).Repeat.Once();
|
||||
|
||||
session.Close();
|
||||
LastCall.On(session).Repeat.Once();
|
||||
session2.Close();
|
||||
LastCall.On(session2).Repeat.Once();
|
||||
|
||||
connection.Close();
|
||||
LastCall.On(connection).Repeat.Twice();
|
||||
|
||||
mocks.ReplayAll();
|
||||
|
||||
EmsTransactionManager tm = new EmsTransactionManager(connectionFactory);
|
||||
ITransactionStatus ts = tm.GetTransaction(new DefaultTransactionDefinition());
|
||||
EmsTemplate nt = new EmsTemplate(connectionFactory);
|
||||
|
||||
|
||||
TransactionTemplate tt = new TransactionTemplate(tm);
|
||||
tt.PropagationBehavior = TransactionPropagation.RequiresNew;
|
||||
tt.Execute(delegate(ITransactionStatus status)
|
||||
{
|
||||
nt.Execute(new AssertNotSameSessionCallback(session));
|
||||
return null;
|
||||
});
|
||||
|
||||
nt.Execute(new AssertSessionCallback(session));
|
||||
|
||||
tm.Commit(ts);
|
||||
|
||||
mocks.VerifyAll();
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
private static void SetupRollbackExpectations(IConnection connection, IConnectionFactory connectionFactory, ISession session)
|
||||
{
|
||||
Expect.Call(connectionFactory.CreateConnection()).Return(connection).Repeat.Once();
|
||||
Expect.Call(connection.CreateSession(true, Session.SESSION_TRANSACTED)).Return(session).Repeat.Once();
|
||||
session.Rollback();
|
||||
LastCall.On(session).Repeat.Once();
|
||||
session.Close();
|
||||
LastCall.On(session).Repeat.Once();
|
||||
connection.Close();
|
||||
LastCall.On(connection).Repeat.Once();
|
||||
}
|
||||
|
||||
private static void SetupCommitExpectations(IConnection connection, IConnectionFactory connectionFactory, ISession session)
|
||||
{
|
||||
Expect.Call(connectionFactory.CreateConnection()).Return(connection).Repeat.Once();
|
||||
Expect.Call(connection.CreateSession(true, Session.SESSION_TRANSACTED)).Return(session).Repeat.Once();
|
||||
session.Commit();
|
||||
LastCall.On(session).Repeat.Once();
|
||||
session.Close();
|
||||
LastCall.On(session).Repeat.Once();
|
||||
connection.Close();
|
||||
LastCall.On(connection).Repeat.Once();
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
Assert.AreEqual(0, TransactionSynchronizationManager.ResourceDictionary.Count);
|
||||
Assert.IsFalse(TransactionSynchronizationManager.SynchronizationActive);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
internal class AssertSessionCallback : ISessionCallback
|
||||
{
|
||||
private ISession session;
|
||||
public AssertSessionCallback(ISession session)
|
||||
{
|
||||
this.session = session;
|
||||
}
|
||||
|
||||
#region ISessionCallback Members
|
||||
|
||||
public object DoInEms(ISession session)
|
||||
{
|
||||
Assert.IsTrue(this.session == session);
|
||||
return null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
internal class AssertNotSameSessionCallback : ISessionCallback
|
||||
{
|
||||
private ISession session;
|
||||
public AssertNotSameSessionCallback(ISession session)
|
||||
{
|
||||
this.session = session;
|
||||
}
|
||||
|
||||
#region ISessionCallback Members
|
||||
|
||||
public object DoInEms(ISession session)
|
||||
{
|
||||
Assert.IsTrue(this.session != session);
|
||||
return null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,296 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright <20> 2002-2007 the original author or authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
#region Imports
|
||||
|
||||
using NUnit.Framework;
|
||||
using Rhino.Mocks;
|
||||
using Spring.Messaging.Ems.Common;
|
||||
using TIBCO.EMS;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Spring.Messaging.Ems.Connections
|
||||
{
|
||||
/// <summary>
|
||||
/// This class contains tests for the SingleConnectionFactory
|
||||
/// </summary>
|
||||
/// <author>Mark Pollack</author>
|
||||
[TestFixture]
|
||||
public class SingleConnectionFactoryTests
|
||||
{
|
||||
private MockRepository mocks;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
mocks = new MockRepository();
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void UsingConnection()
|
||||
{
|
||||
IConnection connection = (IConnection)mocks.CreateMock(typeof(IConnection));
|
||||
|
||||
connection.Start();
|
||||
LastCall.On(connection).Repeat.Twice();
|
||||
connection.Stop();
|
||||
LastCall.On(connection).Repeat.Once();
|
||||
connection.Close();
|
||||
LastCall.On(connection).Repeat.Once();
|
||||
|
||||
mocks.ReplayAll();
|
||||
|
||||
SingleConnectionFactory scf = new SingleConnectionFactory(connection);
|
||||
IConnection con1 = scf.CreateConnection();
|
||||
con1.Start();
|
||||
con1.Stop(); // should be ignored
|
||||
con1.Close(); // should be ignored
|
||||
IConnection con2 = scf.CreateConnection();
|
||||
con2.Start();
|
||||
con2.Stop(); // should be ignored
|
||||
con2.Close(); // should be ignored.
|
||||
scf.Dispose();
|
||||
|
||||
mocks.VerifyAll();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void UsingConnectionFactory()
|
||||
{
|
||||
IConnectionFactory connectionFactory = (IConnectionFactory)mocks.CreateMock(typeof(IConnectionFactory));
|
||||
IConnection connection = (IConnection)mocks.CreateMock(typeof(IConnection));
|
||||
|
||||
Expect.Call(connectionFactory.CreateConnection()).Return(connection).Repeat.Once();
|
||||
connection.Start();
|
||||
LastCall.On(connection).Repeat.Twice();
|
||||
connection.Stop();
|
||||
LastCall.On(connection).Repeat.Once();
|
||||
connection.Close();
|
||||
LastCall.On(connection).Repeat.Once();
|
||||
|
||||
|
||||
mocks.ReplayAll();
|
||||
|
||||
SingleConnectionFactory scf = new SingleConnectionFactory(connectionFactory);
|
||||
IConnection con1 = scf.CreateConnection();
|
||||
con1.Start();
|
||||
con1.Close(); // should be ignored
|
||||
IConnection con2 = scf.CreateConnection();
|
||||
con2.Start();
|
||||
con2.Close(); //should be ignored
|
||||
scf.Dispose(); //should trigger actual close
|
||||
|
||||
mocks.VerifyAll();
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void UsingConnectionFactoryAndClientId()
|
||||
{
|
||||
IConnectionFactory connectionFactory = (IConnectionFactory)mocks.CreateMock(typeof(IConnectionFactory));
|
||||
IConnection connection = (IConnection)mocks.CreateMock(typeof(IConnection));
|
||||
|
||||
Expect.Call(connectionFactory.CreateConnection()).Return(connection).Repeat.Once();
|
||||
connectionFactory.ClientID = "MyId";
|
||||
LastCall.On(connectionFactory).Repeat.Once();
|
||||
connection.ClientID = "MyId";
|
||||
LastCall.On(connection).Repeat.Once();
|
||||
connection.Start();
|
||||
LastCall.On(connection).Repeat.Twice();
|
||||
connection.Stop();
|
||||
LastCall.On(connection).Repeat.Once();
|
||||
connection.Close();
|
||||
LastCall.On(connection).Repeat.Once();
|
||||
|
||||
mocks.ReplayAll();
|
||||
|
||||
SingleConnectionFactory scf = new SingleConnectionFactory(connectionFactory);
|
||||
scf.ClientID = "MyId";
|
||||
IConnection con1 = scf.CreateConnection();
|
||||
con1.Start();
|
||||
con1.Close(); // should be ignored
|
||||
IConnection con2 = scf.CreateConnection();
|
||||
con2.Start();
|
||||
con2.Close(); // should be ignored
|
||||
scf.Dispose(); // should trigger actual close
|
||||
|
||||
mocks.VerifyAll();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void UsingConnectionFactoryAndExceptionListener()
|
||||
{
|
||||
IConnectionFactory connectionFactory = (IConnectionFactory)mocks.CreateMock(typeof(IConnectionFactory));
|
||||
IConnection connection = (IConnection)mocks.CreateMock(typeof(IConnection));
|
||||
|
||||
|
||||
IExceptionListener listener = new ChainedExceptionListener();
|
||||
Expect.Call(connectionFactory.CreateConnection()).Return(connection).Repeat.Once();
|
||||
connection.ExceptionListener = listener;
|
||||
LastCall.On(connection).IgnoreArguments();
|
||||
Expect.Call(connection.ExceptionListener).Return(listener).Repeat.Once();
|
||||
|
||||
connection.Start();
|
||||
LastCall.On(connection).Repeat.Twice();
|
||||
connection.Stop();
|
||||
LastCall.On(connection).Repeat.Once();
|
||||
connection.Close();
|
||||
LastCall.On(connection).Repeat.Once();
|
||||
|
||||
mocks.ReplayAll();
|
||||
|
||||
SingleConnectionFactory scf = new SingleConnectionFactory(connectionFactory);
|
||||
scf.ExceptionListener = listener;
|
||||
IConnection con1 = scf.CreateConnection();
|
||||
|
||||
Assert.AreEqual(listener, connection.ExceptionListener);
|
||||
|
||||
con1.Start();
|
||||
con1.Stop(); // should be ignored
|
||||
con1.Close(); // should be ignored
|
||||
IConnection con2 = scf.CreateConnection();
|
||||
con2.Start();
|
||||
con2.Stop();
|
||||
con2.Close();
|
||||
scf.Dispose();
|
||||
|
||||
mocks.VerifyAll();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void UsingConnectionFactoryAndReconnectOnException()
|
||||
{
|
||||
IConnectionFactory connectionFactory = (IConnectionFactory)mocks.CreateMock(typeof(IConnectionFactory));
|
||||
TestConnection con = new TestConnection();
|
||||
|
||||
Expect.Call(connectionFactory.CreateConnection()).Return(con).Repeat.Twice();
|
||||
|
||||
mocks.ReplayAll();
|
||||
|
||||
SingleConnectionFactory scf = new SingleConnectionFactory(connectionFactory);
|
||||
scf.ReconnectOnException = true;
|
||||
IConnection con1 = scf.CreateConnection();
|
||||
|
||||
con1.Start();
|
||||
con.FireExcpetionEvent(new EMSException(""));
|
||||
IConnection con2 = scf.CreateConnection();
|
||||
con2.Start();
|
||||
scf.Dispose();
|
||||
|
||||
mocks.VerifyAll();
|
||||
|
||||
Assert.AreEqual(2, con.StartCount);
|
||||
Assert.AreEqual(2, con.CloseCount);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void UsingConnectionFactoryAndExceptionListenerAndReconnectOnException()
|
||||
{
|
||||
IConnectionFactory connectionFactory = (IConnectionFactory)mocks.CreateMock(typeof(IConnectionFactory));
|
||||
TestConnection con = new TestConnection();
|
||||
TestExceptionListener listener = new TestExceptionListener();
|
||||
|
||||
Expect.Call(connectionFactory.CreateConnection()).Return(con).Repeat.Twice();
|
||||
|
||||
mocks.ReplayAll();
|
||||
|
||||
SingleConnectionFactory scf = new SingleConnectionFactory(connectionFactory);
|
||||
scf.ExceptionListener = listener;
|
||||
scf.ReconnectOnException = true;
|
||||
IConnection con1 = scf.CreateConnection();
|
||||
//Assert.AreSame(listener, );
|
||||
con1.Start();
|
||||
con.FireExcpetionEvent(new EMSException(""));
|
||||
IConnection con2 = scf.CreateConnection();
|
||||
con2.Start();
|
||||
scf.Dispose();
|
||||
|
||||
mocks.VerifyAll();
|
||||
|
||||
Assert.AreEqual(2, con.StartCount);
|
||||
Assert.AreEqual(2, con.CloseCount);
|
||||
Assert.AreEqual(1, listener.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CachingConnectionFactory()
|
||||
{
|
||||
IConnectionFactory connectionFactory = (IConnectionFactory)mocks.CreateMock(typeof(IConnectionFactory));
|
||||
IConnection connection = (IConnection)mocks.CreateMock(typeof(IConnection));
|
||||
ISession txSession = (ISession)mocks.CreateMock(typeof(ISession));
|
||||
ISession nonTxSession = (ISession)mocks.CreateMock(typeof(ISession));
|
||||
Expect.Call(connectionFactory.CreateConnection()).Return(connection).Repeat.Once();
|
||||
|
||||
Expect.Call(connection.CreateSession(true, SessionMode.SessionTransacted)).Return(txSession).Repeat.Once();
|
||||
Expect.Call(txSession.Transacted).Return(true).Repeat.Twice();
|
||||
txSession.Rollback();
|
||||
LastCall.Repeat.Once();
|
||||
txSession.Commit();
|
||||
LastCall.Repeat.Once();
|
||||
txSession.Close();
|
||||
LastCall.Repeat.Once();
|
||||
|
||||
Expect.Call(connection.CreateSession(false, SessionMode.ClientAcknowledge)).Return(nonTxSession).Repeat.Once();
|
||||
nonTxSession.Close();
|
||||
LastCall.Repeat.Once();
|
||||
connection.Start();
|
||||
LastCall.Repeat.Twice();
|
||||
connection.Stop();
|
||||
LastCall.Repeat.Once();
|
||||
connection.Close();
|
||||
LastCall.Repeat.Once();
|
||||
|
||||
mocks.ReplayAll();
|
||||
|
||||
CachingConnectionFactory scf = new CachingConnectionFactory(connectionFactory);
|
||||
scf.ReconnectOnException = false;
|
||||
|
||||
IConnection con1 = scf.CreateConnection();
|
||||
ISession session1 = con1.CreateSession(true, Session.SESSION_TRANSACTED);
|
||||
bool b = session1.Transacted;
|
||||
session1.Close(); // should be ignored
|
||||
session1 = con1.CreateSession(false, Session.CLIENT_ACKNOWLEDGE);
|
||||
session1.Close(); // should be ignored
|
||||
con1.Start();
|
||||
con1.Close(); // should be ignored
|
||||
IConnection con2 = scf.CreateConnection();
|
||||
ISession session2 = con2.CreateSession(false, Session.CLIENT_ACKNOWLEDGE);
|
||||
session2.Close(); // should be ignored
|
||||
session2 = con2.CreateSession(true, Session.SESSION_TRANSACTED);
|
||||
session2.Commit();
|
||||
session2.Close(); // should be ignored
|
||||
con2.Start();
|
||||
con2.Close();
|
||||
scf.Dispose();
|
||||
|
||||
mocks.Verify(connectionFactory);
|
||||
mocks.Verify(connection);
|
||||
mocks.Verify(txSession);
|
||||
mocks.Verify(nonTxSession);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
using System;
|
||||
using Spring.Messaging.Ems.Common;
|
||||
using Spring.Messaging.Nms.Connections;
|
||||
using TIBCO.EMS;
|
||||
|
||||
namespace Spring.Messaging.Ems.Connections
|
||||
{
|
||||
public class TestConnection : IConnection
|
||||
{
|
||||
private int startCount;
|
||||
private int closeCount;
|
||||
private int createSessionCount;
|
||||
private string clientId;
|
||||
private IExceptionListener exceptionListener;
|
||||
|
||||
|
||||
public event EMSExceptionHandler EMSExceptionHandler;
|
||||
|
||||
public Connection NativeConnection
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public string ActiveURL
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public long ConnID
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public bool IsClosed
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public bool IsSecure
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public ConnectionMetaData MetaData
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public string ClientID
|
||||
{
|
||||
get { return clientId; }
|
||||
set { clientId = value; }
|
||||
}
|
||||
|
||||
public IExceptionListener ExceptionListener
|
||||
{
|
||||
get { return exceptionListener; }
|
||||
set { exceptionListener = value; }
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
closeCount++;
|
||||
}
|
||||
|
||||
|
||||
public void Start()
|
||||
{
|
||||
startCount++;
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public ISession CreateSession(bool transacted, int acknowledgementMode)
|
||||
{
|
||||
createSessionCount++;
|
||||
return new TestSession();
|
||||
}
|
||||
|
||||
public ISession CreateSession(bool transacted, SessionMode acknowledgementMode)
|
||||
{
|
||||
createSessionCount++;
|
||||
return new TestSession();
|
||||
}
|
||||
|
||||
// To be ported methods
|
||||
|
||||
|
||||
|
||||
// utility methods
|
||||
|
||||
public bool IsStarted
|
||||
{
|
||||
get
|
||||
{
|
||||
if (startCount > 0) return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void FireExcpetionEvent(EMSException e)
|
||||
{
|
||||
exceptionListener.OnException(e);
|
||||
}
|
||||
|
||||
public int StartCount
|
||||
{
|
||||
get { return startCount; }
|
||||
}
|
||||
|
||||
public int CloseCount
|
||||
{
|
||||
get { return closeCount; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright <20> 2002-2007 the original author or authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
using TIBCO.EMS;
|
||||
|
||||
namespace Spring.Messaging.Ems.Connections
|
||||
{
|
||||
public class TestExceptionListener : IExceptionListener
|
||||
{
|
||||
private int count = 0;
|
||||
|
||||
|
||||
public int Count
|
||||
{
|
||||
get { return count; }
|
||||
}
|
||||
|
||||
public void OnException(EMSException exception)
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using Spring.Messaging.Ems.Common;
|
||||
using TIBCO.EMS;
|
||||
|
||||
namespace Spring.Messaging.Ems.Connections
|
||||
{
|
||||
public class TestMessageConsumer : IMessageConsumer
|
||||
{
|
||||
|
||||
private IMessageListener messageListener;
|
||||
|
||||
public Message Receive()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Message Receive(long timeout)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
public Message ReceiveNoWait()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public MessageConsumer NativeMessageConsumer
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public event EMSMessageHandler MessageHandler;
|
||||
|
||||
public IMessageListener MessageListener
|
||||
{
|
||||
get { return messageListener; }
|
||||
set { messageListener = value; }
|
||||
}
|
||||
|
||||
public string MessageSelector
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using Spring.Messaging.Ems.Common;
|
||||
using TIBCO.EMS;
|
||||
|
||||
namespace Spring.Messaging.Ems.Connections
|
||||
{
|
||||
|
||||
public class TestMessageProducer : IMessageProducer
|
||||
{
|
||||
private long timeToLive = 60;
|
||||
private int deliveryMode = Message.DEFAULT_DELIVERY_MODE;
|
||||
private MessageDeliveryMode messageDeliveryMode = MessageDeliveryMode.NonPersistent;
|
||||
|
||||
public void Send(Message message)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Send(Destination destination, Message message)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Send(Message message, int deliveryMode, int priority, long timeToLive)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Send(Message message, MessageDeliveryMode deliveryMode, int priority, long timeToLive)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Send(Destination dest, Message message, int deliveryMode, int priority, long timeToLive)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Send(Destination dest, Message message, MessageDeliveryMode deliveryMode, int priority, long timeToLive)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
public void Close()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public long TimeToLive
|
||||
{
|
||||
get { return timeToLive; }
|
||||
set { timeToLive = value; }
|
||||
}
|
||||
|
||||
|
||||
public int Priority
|
||||
{
|
||||
get { return 1; }
|
||||
set { }
|
||||
}
|
||||
|
||||
public bool DisableMessageID
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
set { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public bool DisableMessageTimestamp
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
set { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public MessageProducer NativeMessageProducer
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public int DeliveryMode
|
||||
{
|
||||
get { return deliveryMode; }
|
||||
set { deliveryMode = value; }
|
||||
}
|
||||
|
||||
public Destination Destination
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public MessageDeliveryMode MsgDeliveryMode
|
||||
{
|
||||
get { return messageDeliveryMode; }
|
||||
set { messageDeliveryMode = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,232 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using Rhino.Mocks;
|
||||
using Spring.Messaging.Ems.Common;
|
||||
using Spring.Messaging.Ems.Connections;
|
||||
using TIBCO.EMS;
|
||||
|
||||
namespace Spring.Messaging.Nms.Connections
|
||||
{
|
||||
|
||||
public class TestSession : ISession
|
||||
{
|
||||
private MockRepository mocks = new MockRepository();
|
||||
private int closeCount;
|
||||
private int createdCount;
|
||||
|
||||
|
||||
public TestSession()
|
||||
{
|
||||
createdCount++;
|
||||
}
|
||||
|
||||
public int CloseCount
|
||||
{
|
||||
get { return closeCount; }
|
||||
}
|
||||
|
||||
|
||||
public int CreatedCount
|
||||
{
|
||||
get { return createdCount; }
|
||||
}
|
||||
|
||||
public IMessageProducer CreateProducer(Destination dest)
|
||||
{
|
||||
return new TestMessageProducer();
|
||||
}
|
||||
|
||||
|
||||
public IMessageConsumer CreateConsumer(Destination destination)
|
||||
{
|
||||
return new TestMessageConsumer();
|
||||
}
|
||||
|
||||
public IMessageConsumer CreateConsumer(Destination destination, string selector)
|
||||
{
|
||||
return new TestMessageConsumer();
|
||||
}
|
||||
|
||||
public IMessageConsumer CreateConsumer(Destination dest, string messageSelector, bool noLocal)
|
||||
{
|
||||
return new TestMessageConsumer();
|
||||
}
|
||||
|
||||
public ITopicSubscriber CreateDurableSubscriber(Topic topic, string name)
|
||||
{
|
||||
return new TestTopicSubscriber();
|
||||
}
|
||||
|
||||
public ITopicSubscriber CreateDurableSubscriber(Topic topic, string name, string messageSelector, bool noLocal)
|
||||
{
|
||||
return new TestTopicSubscriber();
|
||||
}
|
||||
|
||||
public Queue CreateQueue(string queueName)
|
||||
{
|
||||
return new Queue(queueName);
|
||||
}
|
||||
|
||||
public Topic CreateTopic(string topicName)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
TemporaryQueue ISession.CreateTemporaryQueue()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
TemporaryTopic ISession.CreateTemporaryTopic()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Message CreateMessage()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public TextMessage CreateTextMessage()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public TextMessage CreateTextMessage(string text)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public MapMessage CreateMapMessage()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public ObjectMessage CreateObjectMessage(object body)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public BytesMessage CreateBytesMessage()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public ObjectMessage CreateObjectMessage()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public StreamMessage CreateStreamMessage()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
closeCount++;
|
||||
}
|
||||
|
||||
public void Commit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Rollback()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public bool Transacted
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public int AcknowledgeMode
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public Session NativeSession
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public QueueBrowser CreateBrowser(Queue queue)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public QueueBrowser CreateBrowser(Queue queue, string messageSelector)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Recover()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Run()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Unsubscribe(string name)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Connection Connection
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public bool IsClosed
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public bool IsTransacted
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public IMessageListener MessageListener
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
set { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public long SessID
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public SessionMode SessionAcknowledgeMode
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
|
||||
|
||||
using System;
|
||||
using Spring.Messaging.Ems.Common;
|
||||
using TIBCO.EMS;
|
||||
|
||||
namespace Spring.Messaging.Ems.Connections
|
||||
{
|
||||
public class TestTopicSubscriber : TestMessageConsumer, ITopicSubscriber
|
||||
{
|
||||
public bool NoLocal
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public Topic Topic
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright <20> 2002-2007 the original author or authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using NUnit.Framework;
|
||||
using Rhino.Mocks;
|
||||
using Spring.Messaging.Ems.Common;
|
||||
using Spring.Messaging.Ems.Connections;
|
||||
using Spring.Messaging.Ems.Support.Destinations;
|
||||
using Spring.Transaction.Support;
|
||||
using TIBCO.EMS;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Spring.Messaging.Ems.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// This class contains tests for
|
||||
/// </summary>
|
||||
/// <author>Mark Pollack</author>
|
||||
/// <version>$Id:$</version>
|
||||
[TestFixture]
|
||||
public class MessageTemplateTests
|
||||
{
|
||||
private MockRepository mocks;
|
||||
private IDestinationResolver mockDestinationResolver;
|
||||
private IConnectionFactory mockConnectionFactory;
|
||||
private IConnection mockConnection;
|
||||
|
||||
private ISession mockSession;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
mocks = new MockRepository();
|
||||
CreateMocks();
|
||||
}
|
||||
|
||||
private EmsTemplate CreateTemplate()
|
||||
{
|
||||
EmsTemplate template = new EmsTemplate();
|
||||
template.DestinationResolver = mockDestinationResolver;
|
||||
template.SessionTransacted = UseTransactedTemplate;
|
||||
return template;
|
||||
}
|
||||
|
||||
|
||||
protected virtual bool UseTransactedSession
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
protected virtual bool UseTransactedTemplate
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
private void CreateMocks()
|
||||
{
|
||||
mockConnectionFactory = (IConnectionFactory) mocks.CreateMock(typeof (IConnectionFactory));
|
||||
mockConnection = (IConnection) mocks.CreateMock(typeof (IConnection));
|
||||
mockSession = (ISession) mocks.CreateMock(typeof (ISession));
|
||||
|
||||
TIBCO.EMS.Queue queue = new TIBCO.EMS.Queue("test"); //(Queue) mocks.CreateMock(typeof (Queue));
|
||||
|
||||
Expect.Call(mockConnectionFactory.CreateConnection()).Return(mockConnection).Repeat.Once();
|
||||
if (UseTransactedTemplate)
|
||||
{
|
||||
Expect.Call(mockConnection.CreateSession(true, Session.SESSION_TRANSACTED)).Return(mockSession).Repeat.
|
||||
Once();
|
||||
}
|
||||
else
|
||||
{
|
||||
Expect.Call(mockConnection.CreateSession(false, Session.AUTO_ACKNOWLEDGE)).Return(mockSession).
|
||||
Repeat.
|
||||
Once();
|
||||
}
|
||||
Expect.Call(mockSession.Transacted).Return(true);
|
||||
|
||||
mockDestinationResolver =
|
||||
(IDestinationResolver) mocks.CreateMock(typeof (IDestinationResolver));
|
||||
mockDestinationResolver.ResolveDestinationName(mockSession, "testDestination", false);
|
||||
LastCall.Return(queue).Repeat.Any();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SessionCallback()
|
||||
{
|
||||
EmsTemplate template = CreateTemplate();
|
||||
template.ConnectionFactory = mockConnectionFactory;
|
||||
mockSession.Close();
|
||||
LastCall.On(mockSession).Repeat.Once();
|
||||
mockConnection.Close();
|
||||
LastCall.On(mockConnection).Repeat.Once();
|
||||
|
||||
mocks.ReplayAll();
|
||||
|
||||
template.Execute(delegate(ISession session)
|
||||
{
|
||||
bool b = session.Transacted;
|
||||
return null;
|
||||
});
|
||||
mocks.VerifyAll();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SessionCallbackWithinSynchronizedTransaction()
|
||||
{
|
||||
SingleConnectionFactory scf = new SingleConnectionFactory(mockConnectionFactory);
|
||||
EmsTemplate template = CreateTemplate();
|
||||
template.ConnectionFactory = scf;
|
||||
|
||||
mockConnection.Start();
|
||||
LastCall.On(mockConnection).Repeat.Times(2);
|
||||
Expect.Call(mockSession.Transacted).Return(UseTransactedSession).Repeat.Twice();
|
||||
|
||||
if (UseTransactedTemplate)
|
||||
{
|
||||
mockSession.Commit();
|
||||
LastCall.On(mockSession).Repeat.Once();
|
||||
}
|
||||
|
||||
mockSession.Close();
|
||||
LastCall.On(mockSession).Repeat.Once();
|
||||
mockConnection.Stop();
|
||||
LastCall.On(mockConnection).Repeat.Once();
|
||||
mockConnection.Close();
|
||||
LastCall.On(mockConnection).Repeat.Once();
|
||||
|
||||
mocks.ReplayAll();
|
||||
|
||||
|
||||
TransactionSynchronizationManager.InitSynchronization();
|
||||
|
||||
try
|
||||
{
|
||||
template.Execute(delegate(ISession session)
|
||||
{
|
||||
bool b = session.Transacted;
|
||||
return null;
|
||||
});
|
||||
template.Execute(delegate(ISession session)
|
||||
{
|
||||
bool b = session.Transacted;
|
||||
return null;
|
||||
});
|
||||
|
||||
Assert.AreSame(mockSession, ConnectionFactoryUtils.GetTransactionalSession(scf, null, false));
|
||||
Assert.AreSame(mockSession,
|
||||
ConnectionFactoryUtils.GetTransactionalSession(scf, scf.CreateConnection(), false));
|
||||
|
||||
//In Java this test was doing 'double-duty' and testing TransactionAwareConnectionFactoryProxy, which has
|
||||
//not been implemented in .NET
|
||||
|
||||
template.Execute(delegate(ISession session)
|
||||
{
|
||||
bool b = session.Transacted;
|
||||
return null;
|
||||
});
|
||||
|
||||
IList synchs = TransactionSynchronizationManager.Synchronizations;
|
||||
Assert.AreEqual(1, synchs.Count);
|
||||
ITransactionSynchronization synch = (ITransactionSynchronization) synchs[0];
|
||||
synch.BeforeCommit(false);
|
||||
synch.BeforeCompletion();
|
||||
synch.AfterCommit();
|
||||
synch.AfterCompletion(TransactionSynchronizationStatus.Unknown);
|
||||
}
|
||||
finally
|
||||
{
|
||||
TransactionSynchronizationManager.ClearSynchronization();
|
||||
//Assert.IsTrue(TransactionSynchronizationManager.ResourceDictionary.Count == 0);
|
||||
//Assert.IsFalse(TransactionSynchronizationManager.SynchronizationActive);
|
||||
scf.Dispose();
|
||||
}
|
||||
Assert.IsTrue(TransactionSynchronizationManager.ResourceDictionary.Count == 0);
|
||||
mocks.VerifyAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,240 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright <20> 2002-2007 the original author or authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
using Rhino.Mocks;
|
||||
using Spring.Messaging.Ems.Common;
|
||||
using Spring.Messaging.Ems.Support.Converter;
|
||||
using Spring.Util;
|
||||
using TIBCO.EMS;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Spring.Messaging.Ems.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// This class contains integration tests for SimpleMessageConverer
|
||||
/// </summary>
|
||||
/// <author>Mark Pollack</author>
|
||||
[TestFixture]
|
||||
public class SimpleMessageConverterTests
|
||||
{
|
||||
private MockRepository mocks;
|
||||
private SimpleMessageConverter converter;
|
||||
private ISession session;
|
||||
private TIBCO.EMS.Session tibcoSession = null;
|
||||
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
//ConnectionFactory cf = new ConnectionFactory("tcp://localhost:7222");
|
||||
//Connection c = cf.CreateConnection();
|
||||
Session tibcoSession = null;// c.CreateSession(false, SessionMode.AutoAcknowledge);
|
||||
mocks = new MockRepository();
|
||||
session = (ISession) mocks.CreateMock(typeof (ISession));
|
||||
converter = new SimpleMessageConverter();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void StringConversion()
|
||||
{
|
||||
|
||||
string content = "test";
|
||||
TextMessage message = new TextMessage(tibcoSession, content);
|
||||
|
||||
Expect.Call(session.CreateTextMessage(content)).Return(message).Repeat.Once();
|
||||
string txt = message.Text;
|
||||
|
||||
mocks.ReplayAll();
|
||||
|
||||
|
||||
Message msg = converter.ToMessage(content, session);
|
||||
|
||||
Assert.AreEqual(content, converter.FromMessage(msg));
|
||||
|
||||
mocks.VerifyAll();
|
||||
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ByteArrayConversion()
|
||||
{
|
||||
BytesMessage message = new BytesMessage(tibcoSession);
|
||||
ASCIIEncoding encoding = new ASCIIEncoding();
|
||||
byte[] content = encoding.GetBytes("test");
|
||||
|
||||
Expect.Call(session.CreateBytesMessage()).Return(message);
|
||||
|
||||
|
||||
mocks.ReplayAll();
|
||||
|
||||
Message msg = converter.ToMessage(content, session);
|
||||
message.Reset();
|
||||
Assert.AreEqual(content.Length, ((byte[])converter.FromMessage(msg)).Length);
|
||||
|
||||
mocks.VerifyAll();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MapConversion()
|
||||
{
|
||||
|
||||
MapMessage message = new MapMessage(tibcoSession);
|
||||
IDictionary content = new Hashtable();
|
||||
content["key1"] = "value1";
|
||||
content["key2"] = "value2";
|
||||
|
||||
Expect.Call(session.CreateMapMessage()).Return(message).Repeat.Once();
|
||||
|
||||
mocks.ReplayAll();
|
||||
|
||||
Message msg = converter.ToMessage(content, session);
|
||||
Assert.AreEqual(content, converter.FromMessage(msg));
|
||||
|
||||
mocks.VerifyAll();
|
||||
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Serializable()
|
||||
{
|
||||
//IObjectMessage message = (IObjectMessage)mocks.CreateMock(typeof(IObjectMessage));
|
||||
|
||||
SerializableWithAttribute content = new SerializableWithAttribute();
|
||||
|
||||
ObjectMessage message = new ObjectMessage(tibcoSession, content);
|
||||
Expect.Call(session.CreateObjectMessage(content)).Return(message).Repeat.Once();
|
||||
|
||||
//Expect.Call(message.TheObject).Return(content).Repeat.Once();
|
||||
|
||||
mocks.ReplayAll();
|
||||
|
||||
|
||||
Message msg = converter.ToMessage(content, session);
|
||||
Assert.AreEqual(content, converter.FromMessage(message));
|
||||
|
||||
mocks.VerifyAll();
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException(typeof(MessageConversionException))]
|
||||
public void ToMessageThrowsExceptionIfGivenNullObjectToConvert()
|
||||
{
|
||||
converter.ToMessage(null, null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException(typeof(MessageConversionException))]
|
||||
public void ToMessageThrowsExceptionIfGivenIncompatibleObjectToConvert()
|
||||
{
|
||||
converter.ToMessage(new Cafe(), null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ToMessageSimplyReturnsMessageAsIsIfSuppliedWithMessage()
|
||||
{
|
||||
SerializableWithAttribute content = new SerializableWithAttribute();
|
||||
|
||||
ObjectMessage message = new ObjectMessage(tibcoSession, content);
|
||||
|
||||
mocks.ReplayAll();
|
||||
|
||||
Message msg = converter.ToMessage(message, session);
|
||||
Assert.AreSame(message, msg);
|
||||
|
||||
mocks.VerifyAll();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void FromMessageSimplyReturnsMessageAsIsIfSuppliedWithMessage()
|
||||
{
|
||||
//IMessage message = (IMessage)mocks.CreateMock(typeof(IMessage));
|
||||
|
||||
StreamMessage message = new StreamMessage(tibcoSession);
|
||||
mocks.ReplayAll();
|
||||
|
||||
Object msg = converter.FromMessage(message);
|
||||
Assert.AreSame(message, msg);
|
||||
|
||||
mocks.VerifyAll();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DictionaryConversionWhereMapHasNonStringTypesForKeys()
|
||||
{
|
||||
//IMapMessage message = (IMapMessage)mocks.CreateMock(typeof(IMapMessage));
|
||||
MapMessage message = new MapMessage(tibcoSession);
|
||||
|
||||
Expect.Call(session.CreateMapMessage()).Return(message);
|
||||
mocks.ReplayAll();
|
||||
|
||||
IDictionary content = new Hashtable();
|
||||
content.Add(new Cafe(), "value1");
|
||||
|
||||
try
|
||||
{
|
||||
converter.ToMessage(content, session);
|
||||
Assert.Fail("Should have thrown MessageConversionException");
|
||||
} catch (MessageConversionException)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
mocks.VerifyAll();
|
||||
}
|
||||
|
||||
|
||||
[Serializable]
|
||||
public class SerializableWithAttribute
|
||||
{
|
||||
public bool Equals(SerializableWithAttribute other)
|
||||
{
|
||||
return !ReferenceEquals(null, other);
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (ReferenceEquals(null, obj)) return false;
|
||||
if (ReferenceEquals(this, obj)) return true;
|
||||
if (obj.GetType() != typeof (SerializableWithAttribute)) return false;
|
||||
return Equals((SerializableWithAttribute) obj);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public class Cafe
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright <20> 2002-2007 the original author or authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
|
||||
using NUnit.Framework;
|
||||
using Rhino.Mocks;
|
||||
using Spring.Messaging.Ems.Common;
|
||||
using Spring.Messaging.Ems.Listener;
|
||||
using TIBCO.EMS;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Spring.Messaging.Ems.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// This class contains tests for
|
||||
/// </summary>
|
||||
/// <author>Mark Pollack</author>
|
||||
/// <version>$Id:$</version>
|
||||
[TestFixture]
|
||||
public class SimpleMessageListenerContainerTests
|
||||
{
|
||||
private static string DESTINATION_NAME = "foo";
|
||||
|
||||
private static Queue QUEUE_DESTINATION = new Queue("banjo");
|
||||
|
||||
private static string EXCEPTION_MESSAGE = "This.Is.It";
|
||||
|
||||
private SimpleMessageListenerContainer container;
|
||||
|
||||
private MockRepository mocks;
|
||||
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
mocks = new MockRepository();
|
||||
container = new SimpleMessageListenerContainer();
|
||||
}
|
||||
|
||||
|
||||
|
||||
[Test]
|
||||
public void RegisteredExceptionListenerIsInvokedOnException()
|
||||
{
|
||||
SimpleMessageConsumer messageConsumer = new SimpleMessageConsumer();
|
||||
|
||||
ISession session = (ISession) mocks.CreateMock(typeof (ISession));
|
||||
Expect.Call(session.CreateQueue(DESTINATION_NAME)).Return(QUEUE_DESTINATION);
|
||||
Expect.Call(session.CreateConsumer(QUEUE_DESTINATION, null)).Return(messageConsumer);
|
||||
// an exception is thrown, so the rollback logic is being applied here...
|
||||
Expect.Call(session.Transacted).Return(false);
|
||||
|
||||
IConnection connection = (IConnection)mocks.CreateMock(typeof(IConnection));
|
||||
//connection.ExceptionListener += container.OnException;
|
||||
connection.ExceptionListener = container;
|
||||
Expect.Call(connection.CreateSession(false, container.SessionAcknowledgeMode)).Return(session);
|
||||
connection.Start();
|
||||
|
||||
IConnectionFactory connectionFactory = (IConnectionFactory) mocks.CreateMock(typeof (IConnectionFactory));
|
||||
Expect.Call(connectionFactory.CreateConnection()).Return(connection);
|
||||
|
||||
EMSException theException = new EMSException(EXCEPTION_MESSAGE);
|
||||
|
||||
IExceptionListener exceptionListener = (IExceptionListener) mocks.CreateMock(typeof (IExceptionListener));
|
||||
exceptionListener.OnException(theException);
|
||||
|
||||
//IMessage message = (IMessage) mocks.CreateMock(typeof (IMessage));
|
||||
TextMessage message = new TextMessage(null, "hello");
|
||||
mocks.ReplayAll();
|
||||
|
||||
|
||||
container.ConnectionFactory = connectionFactory;
|
||||
container.DestinationName = DESTINATION_NAME;
|
||||
container.MessageListener = new BadSessionAwareMessageListener(theException);
|
||||
container.ExceptionListener = exceptionListener;
|
||||
container.AfterPropertiesSet();
|
||||
|
||||
// manually trigger an Exception with the above bad MessageListener...
|
||||
messageConsumer.SendMessage(message);
|
||||
|
||||
|
||||
|
||||
mocks.VerifyAll();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
internal class BadSessionAwareMessageListener : ISessionAwareMessageListener
|
||||
{
|
||||
private EMSException exception;
|
||||
public BadSessionAwareMessageListener(EMSException exception)
|
||||
{
|
||||
this.exception = exception;
|
||||
}
|
||||
|
||||
public void OnMessage(Message message, ISession session)
|
||||
{
|
||||
throw exception;
|
||||
}
|
||||
}
|
||||
|
||||
internal class SimpleMessageConsumer : IMessageConsumer
|
||||
{
|
||||
private IMessageListener messageListener;
|
||||
|
||||
public void SendMessage(Message message)
|
||||
{
|
||||
messageListener.OnMessage(message);
|
||||
}
|
||||
|
||||
public Message Receive()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Message Receive(long timeout)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Message ReceiveNoWait()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public MessageConsumer NativeMessageConsumer
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public event EMSMessageHandler MessageHandler;
|
||||
|
||||
public IMessageListener MessageListener
|
||||
{
|
||||
get { return messageListener; }
|
||||
set { messageListener = value; }
|
||||
}
|
||||
|
||||
public string MessageSelector
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -79,6 +79,7 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="Messaging\Ems\Config\EmsNamespaceHandlerTests.cs" />
|
||||
<Compile Include="Messaging\Ems\Connections\TestMessageListener.cs" />
|
||||
<Compile Include="Messaging\Ems\Core\MessageTemplateTests.cs" />
|
||||
<Compile Include="Messaging\Ems\Integration\LoggingExceptionHandler.cs" />
|
||||
<Compile Include="Messaging\Ems\Integration\SimpleMessageListener.cs" />
|
||||
<Compile Include="Messaging\Ems\Integration\SimpleMessageListenerContainerTests.cs" />
|
||||
|
||||
@@ -0,0 +1,163 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{94E4E1B4-D424-4EB9-BF34-2EE8CC3D7048}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Spring</RootNamespace>
|
||||
<AssemblyName>Spring.Messaging.Ems.Tests</AssemblyName>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<OldToolsVersion>2.0</OldToolsVersion>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<PublishUrl>http://localhost/Spring.Messaging.Ems.Tests/</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Web</InstallFrom>
|
||||
<UpdateEnabled>true</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>true</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\..\build\VS.NET.2005\Spring.Messaging.Ems.Tests\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;NET_2_0</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\..\build\VS.NET.2005\Spring.Messaging.Ems.Tests\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NET_2_0</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Common.Logging, Version=1.2.0.0, Culture=neutral, PublicKeyToken=af08829b84f0328e">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\lib\Net\2.0\Common.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="nunit.framework, Version=2.2.7.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\lib\net\2.0\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Rhino.Mocks, Version=2.9.6.40380, Culture=neutral, PublicKeyToken=0b3305902db7183f, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\lib\Net\2.0\Rhino.Mocks.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="TIBCO.EMS, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5b83db8ff05c64ba, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\lib\Net\2.0\TIBCO.EMS.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="TIBCO.EMS.ADMIN, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5b83db8ff05c64ba, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\lib\Net\2.0\TIBCO.EMS.ADMIN.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Aop\Spring.Aop.2008.csproj">
|
||||
<Project>{3A3A4E65-45A6-4B20-B460-0BEDC302C02C}</Project>
|
||||
<Name>Spring.Aop.2008</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Core\Spring.Core.2008.csproj">
|
||||
<Project>{710961A3-0DF4-49E4-A26E-F5B9C044AC84}</Project>
|
||||
<Name>Spring.Core.2008</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Data\Spring.Data.2008.csproj">
|
||||
<Project>{AE00E5AB-C39A-436F-86D2-33BFE33E2E40}</Project>
|
||||
<Name>Spring.Data.2008</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Messaging.Ems\Spring.Messaging.Ems.2008.csproj">
|
||||
<Project>{900E3839-301E-48B1-BAEB-B6645620ACFF}</Project>
|
||||
<Name>Spring.Messaging.Ems.2008</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Testing.NUnit\Spring.Testing.NUnit.2008.csproj">
|
||||
<Project>{ED204A7B-832F-44C7-BFE3-504AEBE1BCC8}</Project>
|
||||
<Name>Spring.Testing.NUnit.2008</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Spring.Core.Tests\Spring.Core.Tests.2008.csproj">
|
||||
<Project>{44B16BAA-6DF8-447C-9D7F-3AD3D854D904}</Project>
|
||||
<Name>Spring.Core.Tests.2008</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\CommonAssemblyInfo.cs">
|
||||
<Link>CommonAssemblyInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="AssemblyInfo.cs" />
|
||||
<Compile Include="Messaging\Ems\Config\EmsNamespaceHandlerTests.cs" />
|
||||
<Compile Include="Messaging\Ems\Connections\CachingConnectionFactoryTests.cs" />
|
||||
<Compile Include="Messaging\Ems\Connections\MessageTransactionManagerTests.cs" />
|
||||
<Compile Include="Messaging\Ems\Connections\SingleConnectionFactoryTests.cs" />
|
||||
<Compile Include="Messaging\Ems\Connections\TestConnection.cs" />
|
||||
<Compile Include="Messaging\Ems\Connections\TestExceptionListener.cs" />
|
||||
<Compile Include="Messaging\Ems\Connections\TestMessageConsumer.cs" />
|
||||
<Compile Include="Messaging\Ems\Connections\TestMessageListener.cs" />
|
||||
<Compile Include="Messaging\Ems\Connections\TestMessageProducer.cs" />
|
||||
<Compile Include="Messaging\Ems\Connections\TestSession.cs" />
|
||||
<Compile Include="Messaging\Ems\Connections\TestTopicSubscriber.cs" />
|
||||
<Compile Include="Messaging\Ems\Core\MessageTemplateTests.cs" />
|
||||
<Compile Include="Messaging\Ems\Core\SimpleMessageConverterTests.cs" />
|
||||
<Compile Include="Messaging\Ems\Core\SimpleMessageListenerContainerTests.cs" />
|
||||
<Compile Include="Messaging\Ems\Integration\LoggingExceptionHandler.cs" />
|
||||
<Compile Include="Messaging\Ems\Integration\SimpleMessageListener.cs" />
|
||||
<Compile Include="Messaging\Ems\Integration\SimpleMessageListenerContainerTests.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Messaging\Ems\Integration\SimpleMessageListenerContainerTests.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Messaging\Ems\Config\EmsNamespaceHandlerTests.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework Client Profile</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 2.0 %28x86%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.0 %28x86%29</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -1,4 +1,22 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using Apache.NMS;
|
||||
|
||||
@@ -34,10 +34,9 @@ using Spring.Transaction.Support;
|
||||
namespace Spring.Messaging.Nms.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// This class contains tests for
|
||||
/// This class contains tests for NmsTemplate
|
||||
/// </summary>
|
||||
/// <author>Mark Pollack</author>
|
||||
/// <version>$Id:$</version>
|
||||
[TestFixture]
|
||||
public class MessageTemplateTests
|
||||
{
|
||||
|
||||
@@ -31,10 +31,9 @@ using Spring.Messaging.Nms.Listener;
|
||||
namespace Spring.Messaging.Nms.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// This class contains tests for
|
||||
/// This class contains tests for SimpleMessageListenerContainer
|
||||
/// </summary>
|
||||
/// <author>Mark Pollack</author>
|
||||
/// <version>$Id:$</version>
|
||||
[TestFixture]
|
||||
public class SimpleMessageListenerContainerTests
|
||||
{
|
||||
|
||||
@@ -89,6 +89,9 @@
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\CommonAssemblyInfo.cs">
|
||||
<Link>CommonAssemblyInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="AssemblyInfo.cs" />
|
||||
<Compile Include="Messaging\Nms\Config\NmsNamespaceHandlerTests.cs" />
|
||||
<Compile Include="Messaging\Nms\Connections\CachingConnectionFactoryTests.cs" />
|
||||
|
||||
Reference in New Issue
Block a user