diff --git a/src/Spring/Spring.Messaging.Ems/AssemblyInfo.cs b/src/Spring/Spring.Messaging.Ems/AssemblyInfo.cs
new file mode 100644
index 00000000..86b224ce
--- /dev/null
+++ b/src/Spring/Spring.Messaging.Ems/AssemblyInfo.cs
@@ -0,0 +1,5 @@
+using System;
+using System.Reflection;
+
+[assembly: AssemblyTitle("Spring.Messaging.Ems")]
+[assembly: AssemblyDescription("TIBCO EMS support")]
\ No newline at end of file
diff --git a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Common/CertificateStoreConfig.cs b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Common/CertificateStoreConfig.cs
new file mode 100644
index 00000000..966d30de
--- /dev/null
+++ b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Common/CertificateStoreConfig.cs
@@ -0,0 +1,9 @@
+
+
+namespace Spring.Messaging.Ems.Common
+{
+ public class CertificateStoreConfig
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Common/EmsConnectionFactory.cs b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Common/EmsConnectionFactory.cs
index a9bf3f79..1727c13c 100644
--- a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Common/EmsConnectionFactory.cs
+++ b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Common/EmsConnectionFactory.cs
@@ -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
diff --git a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Common/IConnectionFactory.cs b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Common/IConnectionFactory.cs
index 3952ec85..f0c52c2d 100644
--- a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Common/IConnectionFactory.cs
+++ b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Common/IConnectionFactory.cs
@@ -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; }
diff --git a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/SingleConnectionFactory.cs b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/SingleConnectionFactory.cs
index 9f2c3556..d33c625d 100644
--- a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/SingleConnectionFactory.cs
+++ b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/SingleConnectionFactory.cs
@@ -158,6 +158,7 @@ namespace Spring.Messaging.Ems.Connections
/// The exception listener.
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);
- }*/
}
///
diff --git a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Listener/Adapter/MessageListenerAdapter.cs b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Listener/Adapter/MessageListenerAdapter.cs
index 8d38cda3..fc1c98d6 100644
--- a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Listener/Adapter/MessageListenerAdapter.cs
+++ b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Listener/Adapter/MessageListenerAdapter.cs
@@ -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.
///
/// The destination resolver.
- public DestinationResolver DestinationResolver
+ public IDestinationResolver DestinationResolver
{
get { return destinationResolver; }
set
diff --git a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Support/Destinations/DynamicDestinationResolver.cs b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Support/Destinations/DynamicDestinationResolver.cs
index 11d2a1c4..08c5c49b 100644
--- a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Support/Destinations/DynamicDestinationResolver.cs
+++ b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Support/Destinations/DynamicDestinationResolver.cs
@@ -29,7 +29,7 @@ namespace Spring.Messaging.Ems.Support.Destinations
///
/// Juergen Hoeller
/// Mark Pollack (.NET)
- public class DynamicDestinationResolver : DestinationResolver
+ public class DynamicDestinationResolver : IDestinationResolver
{
/// Resolve the given destination name, either as located resource
/// or as dynamic destination.
diff --git a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Support/Destinations/EmsDestinationAccessor.cs b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Support/Destinations/EmsDestinationAccessor.cs
index 16d40db5..888bcdc5 100644
--- a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Support/Destinations/EmsDestinationAccessor.cs
+++ b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Support/Destinations/EmsDestinationAccessor.cs
@@ -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.
///
/// The destination resolver.
- virtual public DestinationResolver DestinationResolver
+ virtual public IDestinationResolver DestinationResolver
{
get
{
diff --git a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Support/Destinations/IDestinationResolver.cs b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Support/Destinations/IDestinationResolver.cs
index 92a7f45e..f15c7e91 100644
--- a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Support/Destinations/IDestinationResolver.cs
+++ b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Support/Destinations/IDestinationResolver.cs
@@ -39,7 +39,7 @@ namespace Spring.Messaging.Ems.Support.Destinations
///
/// Juergen Hoeller
/// Mark Pollack (.NET)
- public interface DestinationResolver
+ public interface IDestinationResolver
{
/// Resolve the given destination name, either as located resource
/// or as dynamic destination.
diff --git a/src/Spring/Spring.Messaging.Ems/Spring.Messaging.Ems.2005.csproj b/src/Spring/Spring.Messaging.Ems/Spring.Messaging.Ems.2005.csproj
new file mode 100644
index 00000000..cc41cb7e
--- /dev/null
+++ b/src/Spring/Spring.Messaging.Ems/Spring.Messaging.Ems.2005.csproj
@@ -0,0 +1,135 @@
+
+
+ Debug
+ AnyCPU
+ 8.0.50727
+ 2.0
+ {900E3839-301E-48B1-BAEB-B6645620ACFF}
+ Library
+ Properties
+ Spring
+ Spring.Messaging.Ems
+
+
+ true
+ full
+ false
+ ..\..\..\build\VS.NET.2005\Spring.Messaging.Ems\Debug\
+ TRACE;DEBUG;NET_2_0
+ prompt
+ 4
+ ..\..\..\build\VS.NET.2005\Spring.Messaging.Ems\Debug\Spring.Messaging.Ems.xml
+
+
+ pdbonly
+ true
+ ..\..\..\build\VS.NET.2005\Spring.Messaging.Ems\Release\
+ TRACE;NET_2_0
+ prompt
+ 4
+
+
+
+ False
+ ..\..\..\lib\Net\2.0\antlr.runtime.dll
+
+
+ False
+ ..\..\..\lib\net\2.0\Common.Logging.dll
+
+
+
+
+
+ False
+ ..\..\..\lib\Net\2.0\TIBCO.EMS.dll
+
+
+
+
+ {3A3A4E65-45A6-4B20-B460-0BEDC302C02C}
+ Spring.Aop.2005
+
+
+ {710961A3-0DF4-49E4-A26E-F5B9C044AC84}
+ Spring.Core.2005
+
+
+ {AE00E5AB-C39A-436F-86D2-33BFE33E2E40}
+ Spring.Data.2005
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Designer
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Spring/Spring.Messaging.Ems/Spring.Messaging.Ems.2008.csproj b/src/Spring/Spring.Messaging.Ems/Spring.Messaging.Ems.2008.csproj
new file mode 100644
index 00000000..2ea80f83
--- /dev/null
+++ b/src/Spring/Spring.Messaging.Ems/Spring.Messaging.Ems.2008.csproj
@@ -0,0 +1,187 @@
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {900E3839-301E-48B1-BAEB-B6645620ACFF}
+ Library
+ Properties
+ Spring
+ Spring.Messaging.Ems
+
+
+ 2.0
+
+
+ http://localhost/Spring.Messaging.Ems/
+ true
+ Web
+ true
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ true
+ false
+ true
+
+
+ true
+ full
+ false
+ ..\..\..\build\VS.NET.2005\Spring.Messaging.Ems\Debug\
+ TRACE;DEBUG;NET_2_0
+ prompt
+ 4
+ ..\..\..\build\VS.NET.2005\Spring.Messaging.Ems\Debug\Spring.Messaging.Ems.xml
+
+
+ pdbonly
+ true
+ ..\..\..\build\VS.NET.2005\Spring.Messaging.Ems\Release\
+ TRACE;NET_2_0
+ prompt
+ 4
+
+
+
+ False
+ ..\..\..\lib\Net\2.0\antlr.runtime.dll
+
+
+ False
+ ..\..\..\lib\net\2.0\Common.Logging.dll
+
+
+
+
+
+ False
+ ..\..\..\lib\Net\2.0\TIBCO.EMS.dll
+
+
+
+
+ CommonAssemblyInfo.cs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Designer
+
+
+
+
+ False
+ .NET Framework Client Profile
+ false
+
+
+ False
+ .NET Framework 2.0 %28x86%29
+ true
+
+
+ False
+ .NET Framework 3.0 %28x86%29
+ false
+
+
+ False
+ .NET Framework 3.5
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ false
+
+
+
+
+ {3A3A4E65-45A6-4B20-B460-0BEDC302C02C}
+ Spring.Aop.2008
+
+
+ {710961A3-0DF4-49E4-A26E-F5B9C044AC84}
+ Spring.Core.2008
+
+
+ {AE00E5AB-C39A-436F-86D2-33BFE33E2E40}
+ Spring.Data.2008
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Spring/Spring.Messaging.Nms/AssemblyInfo.cs b/src/Spring/Spring.Messaging.Nms/AssemblyInfo.cs
new file mode 100644
index 00000000..0fb18931
--- /dev/null
+++ b/src/Spring/Spring.Messaging.Nms/AssemblyInfo.cs
@@ -0,0 +1,4 @@
+using System.Reflection;
+
+[assembly: AssemblyTitle("Spring.Messaging.Nms")]
+[assembly: AssemblyDescription("ActiveMQ support")]
\ No newline at end of file
diff --git a/src/Spring/Spring.Messaging.Nms/Spring.Messaging.Nms.2008.csproj b/src/Spring/Spring.Messaging.Nms/Spring.Messaging.Nms.2008.csproj
index fcd0e2f3..31e1eba3 100644
--- a/src/Spring/Spring.Messaging.Nms/Spring.Messaging.Nms.2008.csproj
+++ b/src/Spring/Spring.Messaging.Nms/Spring.Messaging.Nms.2008.csproj
@@ -2,7 +2,7 @@
Debug
AnyCPU
- 9.0.21022
+ 9.0.30729
2.0
{AEB1578C-9018-4D49-B440-789F38DD2F29}
Library
@@ -48,6 +48,10 @@
+
+ CommonAssemblyInfo.cs
+
+
diff --git a/test/Spring/Spring.Messaging.Ems.Tests/AssemblyInfo.cs b/test/Spring/Spring.Messaging.Ems.Tests/AssemblyInfo.cs
new file mode 100644
index 00000000..9677e4cd
--- /dev/null
+++ b/test/Spring/Spring.Messaging.Ems.Tests/AssemblyInfo.cs
@@ -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")]
diff --git a/test/Spring/Spring.Messaging.Ems.Tests/Messaging/Ems/Connections/CachingConnectionFactoryTests.cs b/test/Spring/Spring.Messaging.Ems.Tests/Messaging/Ems/Connections/CachingConnectionFactoryTests.cs
new file mode 100644
index 00000000..1a057075
--- /dev/null
+++ b/test/Spring/Spring.Messaging.Ems.Tests/Messaging/Ems/Connections/CachingConnectionFactoryTests.cs
@@ -0,0 +1,271 @@
+#region License
+
+/*
+ * Copyright © 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
+{
+ ///
+ /// This class contains tests for CachingConnectionFactory
+ ///
+ /// Mark Pollack
+ [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();
+
+
+ }
+
+ ///
+ /// 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).
+ ///
+ [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();
+ }
+
+
+ ///
+ /// 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).
+ ///
+ [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;
+ }
+ }
+}
\ No newline at end of file
diff --git a/test/Spring/Spring.Messaging.Ems.Tests/Messaging/Ems/Connections/MessageTransactionManagerTests.cs b/test/Spring/Spring.Messaging.Ems.Tests/Messaging/Ems/Connections/MessageTransactionManagerTests.cs
new file mode 100644
index 00000000..17ba9804
--- /dev/null
+++ b/test/Spring/Spring.Messaging.Ems.Tests/Messaging/Ems/Connections/MessageTransactionManagerTests.cs
@@ -0,0 +1,337 @@
+#region License
+
+/*
+ * Copyright © 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
+{
+ ///
+ /// This class contains tests for EmsTransactionManager
+ ///
+ /// Mark Pollack
+ [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
+ }
+}
\ No newline at end of file
diff --git a/test/Spring/Spring.Messaging.Ems.Tests/Messaging/Ems/Connections/SingleConnectionFactoryTests.cs b/test/Spring/Spring.Messaging.Ems.Tests/Messaging/Ems/Connections/SingleConnectionFactoryTests.cs
new file mode 100644
index 00000000..cc5c8ba0
--- /dev/null
+++ b/test/Spring/Spring.Messaging.Ems.Tests/Messaging/Ems/Connections/SingleConnectionFactoryTests.cs
@@ -0,0 +1,296 @@
+#region License
+
+/*
+ * Copyright © 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
+{
+ ///
+ /// This class contains tests for the SingleConnectionFactory
+ ///
+ /// Mark Pollack
+ [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);
+
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/test/Spring/Spring.Messaging.Ems.Tests/Messaging/Ems/Connections/TestConnection.cs b/test/Spring/Spring.Messaging.Ems.Tests/Messaging/Ems/Connections/TestConnection.cs
new file mode 100644
index 00000000..18a19667
--- /dev/null
+++ b/test/Spring/Spring.Messaging.Ems.Tests/Messaging/Ems/Connections/TestConnection.cs
@@ -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; }
+ }
+ }
+}
\ No newline at end of file
diff --git a/test/Spring/Spring.Messaging.Ems.Tests/Messaging/Ems/Connections/TestExceptionListener.cs b/test/Spring/Spring.Messaging.Ems.Tests/Messaging/Ems/Connections/TestExceptionListener.cs
new file mode 100644
index 00000000..6636a9c0
--- /dev/null
+++ b/test/Spring/Spring.Messaging.Ems.Tests/Messaging/Ems/Connections/TestExceptionListener.cs
@@ -0,0 +1,40 @@
+#region License
+
+/*
+ * Copyright © 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++;
+ }
+ }
+}
\ No newline at end of file
diff --git a/test/Spring/Spring.Messaging.Ems.Tests/Messaging/Ems/Connections/TestMessageConsumer.cs b/test/Spring/Spring.Messaging.Ems.Tests/Messaging/Ems/Connections/TestMessageConsumer.cs
new file mode 100644
index 00000000..a6db9d0b
--- /dev/null
+++ b/test/Spring/Spring.Messaging.Ems.Tests/Messaging/Ems/Connections/TestMessageConsumer.cs
@@ -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();
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/test/Spring/Spring.Messaging.Ems.Tests/Messaging/Ems/Connections/TestMessageProducer.cs b/test/Spring/Spring.Messaging.Ems.Tests/Messaging/Ems/Connections/TestMessageProducer.cs
new file mode 100644
index 00000000..154d6449
--- /dev/null
+++ b/test/Spring/Spring.Messaging.Ems.Tests/Messaging/Ems/Connections/TestMessageProducer.cs
@@ -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; }
+ }
+ }
+}
\ No newline at end of file
diff --git a/test/Spring/Spring.Messaging.Ems.Tests/Messaging/Ems/Connections/TestSession.cs b/test/Spring/Spring.Messaging.Ems.Tests/Messaging/Ems/Connections/TestSession.cs
new file mode 100644
index 00000000..acaa816d
--- /dev/null
+++ b/test/Spring/Spring.Messaging.Ems.Tests/Messaging/Ems/Connections/TestSession.cs
@@ -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(); }
+ }
+ }
+}
\ No newline at end of file
diff --git a/test/Spring/Spring.Messaging.Ems.Tests/Messaging/Ems/Connections/TestTopicSubscriber.cs b/test/Spring/Spring.Messaging.Ems.Tests/Messaging/Ems/Connections/TestTopicSubscriber.cs
new file mode 100644
index 00000000..fe1b8261
--- /dev/null
+++ b/test/Spring/Spring.Messaging.Ems.Tests/Messaging/Ems/Connections/TestTopicSubscriber.cs
@@ -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(); }
+ }
+ }
+}
\ No newline at end of file
diff --git a/test/Spring/Spring.Messaging.Ems.Tests/Messaging/Ems/Core/MessageTemplateTests.cs b/test/Spring/Spring.Messaging.Ems.Tests/Messaging/Ems/Core/MessageTemplateTests.cs
new file mode 100644
index 00000000..cf5e29d4
--- /dev/null
+++ b/test/Spring/Spring.Messaging.Ems.Tests/Messaging/Ems/Core/MessageTemplateTests.cs
@@ -0,0 +1,200 @@
+#region License
+
+/*
+ * Copyright © 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
+{
+ ///
+ /// This class contains tests for
+ ///
+ /// Mark Pollack
+ /// $Id:$
+ [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();
+ }
+ }
+}
\ No newline at end of file
diff --git a/test/Spring/Spring.Messaging.Ems.Tests/Messaging/Ems/Core/SimpleMessageConverterTests.cs b/test/Spring/Spring.Messaging.Ems.Tests/Messaging/Ems/Core/SimpleMessageConverterTests.cs
new file mode 100644
index 00000000..2a4bc01e
--- /dev/null
+++ b/test/Spring/Spring.Messaging.Ems.Tests/Messaging/Ems/Core/SimpleMessageConverterTests.cs
@@ -0,0 +1,240 @@
+#region License
+
+/*
+ * Copyright © 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
+{
+ ///
+ /// This class contains integration tests for SimpleMessageConverer
+ ///
+ /// Mark Pollack
+ [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
+ {
+
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/test/Spring/Spring.Messaging.Ems.Tests/Messaging/Ems/Core/SimpleMessageListenerContainerTests.cs b/test/Spring/Spring.Messaging.Ems.Tests/Messaging/Ems/Core/SimpleMessageListenerContainerTests.cs
new file mode 100644
index 00000000..47c0855c
--- /dev/null
+++ b/test/Spring/Spring.Messaging.Ems.Tests/Messaging/Ems/Core/SimpleMessageListenerContainerTests.cs
@@ -0,0 +1,177 @@
+#region License
+
+/*
+ * Copyright © 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
+{
+ ///
+ /// This class contains tests for
+ ///
+ /// Mark Pollack
+ /// $Id:$
+ [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();
+ }
+
+
+
+ }
+}
\ No newline at end of file
diff --git a/test/Spring/Spring.Messaging.Ems.Tests/Spring.Messaging.Ems.Tests.2005.csproj b/test/Spring/Spring.Messaging.Ems.Tests/Spring.Messaging.Ems.Tests.2005.csproj
index 1cb30d2d..775aa849 100644
--- a/test/Spring/Spring.Messaging.Ems.Tests/Spring.Messaging.Ems.Tests.2005.csproj
+++ b/test/Spring/Spring.Messaging.Ems.Tests/Spring.Messaging.Ems.Tests.2005.csproj
@@ -79,6 +79,7 @@
+
diff --git a/test/Spring/Spring.Messaging.Ems.Tests/Spring.Messaging.Ems.Tests.2008.csproj b/test/Spring/Spring.Messaging.Ems.Tests/Spring.Messaging.Ems.Tests.2008.csproj
new file mode 100644
index 00000000..a843eab3
--- /dev/null
+++ b/test/Spring/Spring.Messaging.Ems.Tests/Spring.Messaging.Ems.Tests.2008.csproj
@@ -0,0 +1,163 @@
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {94E4E1B4-D424-4EB9-BF34-2EE8CC3D7048}
+ Library
+ Properties
+ Spring
+ Spring.Messaging.Ems.Tests
+
+
+ 2.0
+
+
+ http://localhost/Spring.Messaging.Ems.Tests/
+ true
+ Web
+ true
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ true
+ false
+ true
+
+
+ true
+ full
+ false
+ ..\..\..\build\VS.NET.2005\Spring.Messaging.Ems.Tests\Debug\
+ TRACE;DEBUG;NET_2_0
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ ..\..\..\build\VS.NET.2005\Spring.Messaging.Ems.Tests\Release\
+ TRACE;NET_2_0
+ prompt
+ 4
+
+
+
+ False
+ ..\..\..\lib\Net\2.0\Common.Logging.dll
+
+
+ False
+ ..\..\..\lib\net\2.0\nunit.framework.dll
+
+
+ False
+ ..\..\..\lib\Net\2.0\Rhino.Mocks.dll
+
+
+
+ False
+ ..\..\..\lib\Net\2.0\TIBCO.EMS.dll
+
+
+ False
+ ..\..\..\lib\Net\2.0\TIBCO.EMS.ADMIN.dll
+
+
+
+
+ {3A3A4E65-45A6-4B20-B460-0BEDC302C02C}
+ Spring.Aop.2008
+
+
+ {710961A3-0DF4-49E4-A26E-F5B9C044AC84}
+ Spring.Core.2008
+
+
+ {AE00E5AB-C39A-436F-86D2-33BFE33E2E40}
+ Spring.Data.2008
+
+
+ {900E3839-301E-48B1-BAEB-B6645620ACFF}
+ Spring.Messaging.Ems.2008
+
+
+ {ED204A7B-832F-44C7-BFE3-504AEBE1BCC8}
+ Spring.Testing.NUnit.2008
+
+
+ {44B16BAA-6DF8-447C-9D7F-3AD3D854D904}
+ Spring.Core.Tests.2008
+
+
+
+
+ CommonAssemblyInfo.cs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ False
+ .NET Framework Client Profile
+ false
+
+
+ False
+ .NET Framework 2.0 %28x86%29
+ true
+
+
+ False
+ .NET Framework 3.0 %28x86%29
+ false
+
+
+ False
+ .NET Framework 3.5
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ false
+
+
+
+
+
\ No newline at end of file
diff --git a/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Connections/TestMessageConsumer.cs b/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Connections/TestMessageConsumer.cs
index 7ea57b88..357af79f 100644
--- a/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Connections/TestMessageConsumer.cs
+++ b/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Connections/TestMessageConsumer.cs
@@ -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;
diff --git a/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Core/MessageTemplateTests.cs b/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Core/MessageTemplateTests.cs
index f453a4f0..fde95d09 100644
--- a/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Core/MessageTemplateTests.cs
+++ b/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Core/MessageTemplateTests.cs
@@ -34,10 +34,9 @@ using Spring.Transaction.Support;
namespace Spring.Messaging.Nms.Core
{
///
- /// This class contains tests for
+ /// This class contains tests for NmsTemplate
///
/// Mark Pollack
- /// $Id:$
[TestFixture]
public class MessageTemplateTests
{
diff --git a/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Core/SimpleMessageListenerContainerTests.cs b/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Core/SimpleMessageListenerContainerTests.cs
index 68f621a2..e20b0a09 100644
--- a/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Core/SimpleMessageListenerContainerTests.cs
+++ b/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Core/SimpleMessageListenerContainerTests.cs
@@ -31,10 +31,9 @@ using Spring.Messaging.Nms.Listener;
namespace Spring.Messaging.Nms.Core
{
///
- /// This class contains tests for
+ /// This class contains tests for SimpleMessageListenerContainer
///
/// Mark Pollack
- /// $Id:$
[TestFixture]
public class SimpleMessageListenerContainerTests
{
diff --git a/test/Spring/Spring.Messaging.Nms.Tests/Spring.Messaging.Nms.Tests.2008.csproj b/test/Spring/Spring.Messaging.Nms.Tests/Spring.Messaging.Nms.Tests.2008.csproj
index 7bd21a5d..6d4d918d 100644
--- a/test/Spring/Spring.Messaging.Nms.Tests/Spring.Messaging.Nms.Tests.2008.csproj
+++ b/test/Spring/Spring.Messaging.Nms.Tests/Spring.Messaging.Nms.Tests.2008.csproj
@@ -89,6 +89,9 @@
+
+ CommonAssemblyInfo.cs
+