Support for serialization of the conversation.

Support for serialization of the conversation. Clustering capability for
an application that use this "workaround conversation".
Previously, the implementation of the "Conversation Workaround" was not
capable of serialization. Thus, it was impossible to clustering
applications who used this approach.

These properties will no longer be loaded by direct injection:
"WebConversationManager.SessionFactory",
"WebConversationSpringState.SessionFactory" and
"WebConversationSpringState.DbProvider".
Now we will use this properties:
"WebConversationManager.SessionFactoryName",
"WebConversationSpringState.SessionFactoryname" and
"WebConversationSpringState.DbProviderName". The load of
"ISessionfactory" and "IDbProvider" will be made indirectly by classes
"WebConversationSpringState" and "WebConversationSpringState".
This commit is contained in:
Hailton de Castro Pacheco Barros
2012-07-27 22:06:48 -03:00
parent 126b609f24
commit 62758ce7f5
23 changed files with 574 additions and 80 deletions

View File

@@ -29,7 +29,7 @@
<property name="TimeOut" value="0"></property>
<property name="ConversationManager" ref="conversationManager"></property>
<property name="SessionFactory" ref="NHibernateSessionFactory"/>
<property name="DbProvider" ref="DbProvider"/>
<property name="DbProviderName" value="DbProvider"/>
</object>
@@ -102,7 +102,7 @@
<property name="TimeOut" value="0"></property>
<property name="ConversationManager" ref="conversationManager"></property>
<property name="SessionFactory" ref="NHibernateSessionFactory"/>
<property name="DbProvider" ref="DbProvider"/>
<property name="DbProviderName" value="DbProvider"/>
<!--Using workaround for 'conversation scope' to reference for 'CustomerEditController'. It is not as volatile as "request scope" not as durable as the "session scope"-->
<property name="['CustomerEditController']" ref="CustomerEditController"></property>
</object>

View File

@@ -69,7 +69,7 @@ namespace Spring.ConversationWA
/// Must be the same SessionFactory of the managed conversations.
/// </para>
/// </summary>
ISessionFactory SessionFactory { get; set; }
ISessionFactory SessionFactory { get; }
/// <summary>
/// Ends the "paused conversations" in call to <see cref="ActiveConversation"/>.

View File

@@ -141,12 +141,12 @@ namespace Spring.ConversationWA
ISession RootSessionPerConversation { get; set; }
/// <summary>
/// <para>If this is non-null run pattern c.
/// <para>If this is non-null run pattern 'session-per-conversation'.
/// It also depends on <see cref="DbProvider"/> and <see cref="ConversationManager"/>.
/// <see cref="ConversationManager"/> must support ConversationManager.
/// </para>
/// </summary>
ISessionFactory SessionFactory { get; set; }
ISessionFactory SessionFactory { get; }
/// <summary>
/// <para>If this is non-null run pattern 'session-per-conversation'.
@@ -154,7 +154,7 @@ namespace Spring.ConversationWA
/// <see cref="ConversationManager"/> must support ConversationManager.
/// </para>
/// </summary>
IDbProvider DbProvider { get; set; }
IDbProvider DbProvider { get; }
/// <summary>
/// Indicates that the conversation is paused.

View File

@@ -11,6 +11,7 @@ namespace Spring.ConversationWA.Imple
/// List that make validation for Circular Dependence for <see cref="IConversationState"/>
/// </summary>
/// <author>Hailton de Castro</author>
[Serializable]
public class InnerConversationList: IList<IConversationState>, IList
{
private static readonly ILog LOG = LogManager.GetLogger(typeof(InnerConversationList));

View File

@@ -6,6 +6,8 @@ using System.Web;
using Common.Logging;
using Spring.Data.NHibernate.Support;
using NHibernate;
using Spring.Context;
using Spring.Context.Support;
namespace Spring.ConversationWA.Imple
{
@@ -13,7 +15,8 @@ namespace Spring.ConversationWA.Imple
/// This was made to stay under session scope.
/// </summary>
/// <author>Hailton de Castro</author>
public class WebConversationManager : SessionPerConversationScope, IConversationManager
[Serializable]
public class WebConversationManager : SessionPerConversationScope, IConversationManager, IApplicationContextAware
{
private static readonly ILog LOG = LogManager.GetLogger(typeof(WebConversationManager));
@@ -22,7 +25,18 @@ namespace Spring.ConversationWA.Imple
/// <summary>
/// Semaphore to synchronize writes to the dictionary.
/// </summary>
[NonSerialized]
private Mutex mutexEditDic = new Mutex();
private Mutex MutexEditDic
{
get
{
if (this.mutexEditDic == null)
this.mutexEditDic = new Mutex();
return this.mutexEditDic;
}
}
private IDictionary<String, IConversationState> conversations = new Dictionary<String, IConversationState>();
private IConversationState activeConversation = null;
@@ -53,7 +67,7 @@ namespace Spring.ConversationWA.Imple
try
{
if (LOG.IsDebugEnabled) LOG.Debug("EndOnTimeOut");
this.mutexEditDic.WaitOne(5000);
this.MutexEditDic.WaitOne(5000);
foreach (String keyItem in this.conversations.Keys)
{
IConversationState conversationItem = this.conversations[keyItem];
@@ -69,7 +83,7 @@ namespace Spring.ConversationWA.Imple
}
finally
{
this.mutexEditDic.ReleaseMutex();
this.MutexEditDic.ReleaseMutex();
}
}
@@ -93,7 +107,7 @@ namespace Spring.ConversationWA.Imple
try
{
if (LOG.IsDebugEnabled) LOG.Debug("EndOnTimeOut");
this.mutexEditDic.WaitOne(5000);
this.MutexEditDic.WaitOne(5000);
List<IConversationState> removeList = new List<IConversationState>();
foreach (String keyItem in this.conversations.Keys)
{
@@ -107,7 +121,7 @@ namespace Spring.ConversationWA.Imple
if (removeList.Count > 0)
{
this.Close(this.sessionFactory, removeList);
this.Close(this.SessionFactory, removeList);
}
foreach (IConversationState conversationItem in removeList)
@@ -119,7 +133,7 @@ namespace Spring.ConversationWA.Imple
}
finally
{
this.mutexEditDic.ReleaseMutex();
this.MutexEditDic.ReleaseMutex();
}
}
@@ -131,12 +145,12 @@ namespace Spring.ConversationWA.Imple
{
try
{
this.mutexEditDic.WaitOne(5000);
this.MutexEditDic.WaitOne(5000);
this.conversations.Add(conversation.Id, conversation);
}
finally
{
this.mutexEditDic.ReleaseMutex();
this.MutexEditDic.ReleaseMutex();
}
if (conversation.ConversationManager != null && conversation.ConversationManager != this)
@@ -231,14 +245,32 @@ namespace Spring.ConversationWA.Imple
}
}
private String sessionFactoryName;
/// <summary>
/// "SessionFactory" name in the current context.
/// This approach is required to support serialization.
/// </summary>
public String SessionFactoryName
{
get { return sessionFactoryName; }
set { sessionFactoryName = value; }
}
[NonSerialized]
private ISessionFactory sessionFactory;
/// <summary>
/// <see cref="IConversationManager"/>
/// </summary>
public ISessionFactory SessionFactory
{
get { return sessionFactory; }
set { sessionFactory = value; }
get
{
if (this.sessionFactory == null && this.sessionFactoryName != null)
{
this.sessionFactory = this.ApplicationContext.GetObject<ISessionFactory>(this.sessionFactoryName);
}
return sessionFactory;
}
}
private bool endPaused = false;
@@ -280,7 +312,7 @@ namespace Spring.ConversationWA.Imple
{
try
{
this.mutexEditDic.WaitOne(5000);
this.MutexEditDic.WaitOne(5000);
if (!this.conversations.Remove(conversation.Id))
{
throw new InvalidOperationException(String.Format("Conversation '{0}' not exists on this manager", conversation.Id));
@@ -288,8 +320,35 @@ namespace Spring.ConversationWA.Imple
}
finally
{
this.mutexEditDic.ReleaseMutex();
this.MutexEditDic.ReleaseMutex();
}
}
#region IApplicationContextAware Members
private String applicationContextName;
[NonSerialized]
private IApplicationContext applicationContext = null;
/// <summary>
/// Returns the current context. Supports serialization and deserialization.
/// </summary>
public IApplicationContext ApplicationContext
{
set
{
this.applicationContext = value;
this.applicationContextName = this.applicationContext.Name;
}
get
{
if (this.applicationContext == null)
{
this.applicationContext = ContextRegistry.GetContext(this.applicationContextName);
}
return this.applicationContext;
}
}
#endregion
}
}

View File

@@ -15,6 +15,8 @@ using Spring.Data.Common;
using NHibernate;
using Spring.Data.NHibernate.Support;
using Spring.Data.NHibernate;
using Spring.Context;
using Spring.Context.Support;
namespace Spring.ConversationWA.Imple
{
@@ -23,7 +25,8 @@ namespace Spring.ConversationWA.Imple
/// It avoid Circular Dependence.
/// </summary>
/// <author>Hailton de Castro</author>
public class WebConversationSpringState : IConversationState, IObjectNameAware
[Serializable]
public class WebConversationSpringState : IConversationState, IObjectNameAware, IApplicationContextAware
{
private static readonly ILog LOG = LogManager.GetLogger(typeof(WebConversationSpringState));
@@ -276,24 +279,60 @@ namespace Spring.ConversationWA.Imple
}
}
private String sessionFactoryName;
/// <summary>
/// "SessionFactory" name in the current context.
/// This approach is required to support serialization.
/// </summary>
public String SessionFactoryName
{
get { return sessionFactoryName; }
set { sessionFactoryName = value; }
}
[NonSerialized]
private ISessionFactory sessionFactory;
/// <summary>
/// <see cref="IConversationState"/>
/// </summary>
public ISessionFactory SessionFactory
{
get { return sessionFactory; }
set { sessionFactory = value; }
get
{
if (this.sessionFactory == null && this.sessionFactoryName != null)
{
this.sessionFactory = this.ApplicationContext.GetObject<ISessionFactory>(this.sessionFactoryName);
}
return sessionFactory;
}
}
IDbProvider dbProvider;
private String dbProviderName;
/// <summary>
/// "DbProvider" name in the current context.
/// This approach is required to support serialization.
/// </summary>
public String DbProviderName
{
get { return dbProviderName; }
set { dbProviderName = value; }
}
[NonSerialized]
private IDbProvider dbProvider;
/// <summary>
/// <see cref="IConversationState"/>
/// </summary>
public IDbProvider DbProvider
{
get { return dbProvider; }
set { dbProvider = value; }
get
{
if (this.dbProvider == null && this.dbProviderName != null)
{
this.dbProvider = this.ApplicationContext.GetObject<IDbProvider>(this.dbProviderName);
}
return dbProvider;
}
}
private bool isNew = true;
@@ -597,5 +636,31 @@ namespace Spring.ConversationWA.Imple
{
return base.GetHashCode();
}
#region IApplicationContextAware Members
private String applicationContextName;
[NonSerialized]
private IApplicationContext applicationContext = null;
/// <summary>
/// Returns the current context. Supports serialization and deserialization.
/// </summary>
public IApplicationContext ApplicationContext
{
set
{
this.applicationContext = value;
this.applicationContextName = this.applicationContext.Name;
}
get
{
if (this.applicationContext == null)
{
this.applicationContext = ContextRegistry.GetContext(this.applicationContextName);
}
return this.applicationContext;
}
}
#endregion
}
}

View File

@@ -42,6 +42,7 @@ namespace Spring.Data.NHibernate.Support
/// for dupport to 'session-per-conversation' pattern.
///</summary>
///<author>Hailton de Castro</author>
[Serializable]
public class SessionPerConversationScope : IDisposable
{
#region Fields

View File

@@ -10,6 +10,7 @@ namespace Spring.Data.NHibernate.Support
/// Setting for <see cref="SessionPerConversationScope"/>
/// </summary>
/// <author>Hailton de Castro</author>
[Serializable]
public class SessionPerConversationScopeSettings
{
/// <summary>

View File

@@ -73,7 +73,6 @@
<Link>nant.xsd</Link>
</None>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Spring.Core\Spring.Core.2008.csproj">

View File

@@ -0,0 +1,244 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
using System.Runtime.Remoting.Messaging;
using System.Runtime.Serialization;
using System.Reflection;
using Spring.Entities;
namespace Spring.ConversationWA
{
/// <summary>
/// Module that forces the serialization and deserialization of the session content to simulate a clustered server for
/// <see cref="WebConversationStateTest.SerializeConversationTest"/>.
/// </summary>
public class SerializeConversationTestModule: IHttpModule
{
#region Logging
private static readonly Common.Logging.ILog LOG = Common.Logging.LogManager.GetLogger(typeof(SerializeConversationTestModule));
#endregion
/// <summary>
/// Serialized Session Content.
/// </summary>
private static MemoryStream SerializedSessionContentStream = new MemoryStream();
#region IHttpModule Members
/// <summary>
/// TODO:
/// </summary>
public void Dispose()
{
//
}
/// <summary>
/// TODO:
/// </summary>
/// <param name="context"></param>
public void Init(HttpApplication context)
{
context.PreRequestHandlerExecute += new EventHandler(context_PreRequestHandlerExecute);
context.PostRequestHandlerExecute += new EventHandler(context_PostRequestHandlerExecute);
}
/// <summary>
/// Repopulates the session from the previously serialized content.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void context_PreRequestHandlerExecute(object sender, EventArgs e)
{
if (HttpContext.Current.Session != null)
{
if (HttpContext.Current.Request.AppRelativeCurrentExecutionFilePath == "~/SerializeConversationTest.aspx")
{
if (SerializedSessionContentStream.Length > 0)
{
BinaryFormatter bf = new BinaryFormatter();
bf.Binder = new MyBinder();
//SurrogateSelector surrogateSelector = new SurrogateSelector();
//surrogateSelector.AddSurrogate(
// typeof(Object),
// new StreamingContext(StreamingContextStates.All),
// new MySerializationSurrogate());
//bf.SurrogateSelector = surrogateSelector;
SerializedSessionContentStream.Seek(0, SeekOrigin.Begin);
Dictionary<string, object> sessionConttent =
(Dictionary<string, object>)bf.Deserialize(SerializedSessionContentStream);
HttpContext.Current.Session.Clear();
foreach (String keyItem in sessionConttent.Keys)
{
HttpContext.Current.Session[keyItem] = sessionConttent[keyItem];
}
}
}
}
}
/// <summary>
/// Serializes and clears the session.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void context_PostRequestHandlerExecute(object sender, EventArgs e)
{
if (HttpContext.Current.Session != null)
{
//NHibernate.ISession ss;
if (HttpContext.Current.Request.AppRelativeCurrentExecutionFilePath == "~/SerializeConversationTest.aspx")
{
Dictionary<string, object> sessionConttent = new Dictionary<string, object>();
foreach (String keyItem in HttpContext.Current.Session.Keys)
{
sessionConttent[keyItem] = HttpContext.Current.Session[keyItem];
}
BinaryFormatter bf = new BinaryFormatter();
bf.Binder = new MyBinder();
//SurrogateSelector surrogateSelector = new SurrogateSelector();
//surrogateSelector.AddSurrogate(
// typeof(Object),
// new StreamingContext(StreamingContextStates.All),
// new MySerializationSurrogate());
//bf.SurrogateSelector = surrogateSelector;
SerializedSessionContentStream = new MemoryStream();
bf.Serialize(SerializedSessionContentStream, sessionConttent);
HttpContext.Current.Session.Clear();
}
}
}
#endregion
}
public class MyBinder : SerializationBinder
{
#region Logging
private Common.Logging.ILog LOG
{
get
{
return Common.Logging.LogManager.GetLogger(typeof(SerializeConversationTestModule));
}
}
#endregion
public override Type BindToType(string assemblyName, string typeName)
{
if (LOG.IsDebugEnabled)
LOG.Debug(String.Format("MyBinder.BindToType: {0}, {1}", typeName, assemblyName));
return Type.GetType(typeName + ", " + assemblyName);
}
}
///// <summary>
///// For debugging purpose.
///// </summary>
//public class MySurrogateSelectorWrapper : ISurrogateSelector
//{
// ISurrogateSelector wrapped;
// public MySurrogateSelectorWrapper(ISurrogateSelector wrapped)
// {
// this.wrapped = wrapped;
// }
// #region ISurrogateSelector Members
// public void ChainSelector(ISurrogateSelector selector)
// {
// this.wrapped.ChainSelector(selector);
// }
// public ISurrogateSelector GetNextSelector()
// {
// ISurrogateSelector selector = this.wrapped.GetNextSelector();
// if (!(selector is MySurrogateSelectorWrapper))
// selector = new MySurrogateSelectorWrapper(selector);
// return selector;
// }
// public ISerializationSurrogate GetSurrogate(Type type, StreamingContext context, out ISurrogateSelector selector)
// {
// ISerializationSurrogate surrogate = new MySerializationSurrogate(this.wrapped.GetSurrogate(type, context, out selector));
// if (!(selector is MySurrogateSelectorWrapper))
// selector = new MySurrogateSelectorWrapper(selector);
// return surrogate;
// }
// #endregion
//}
/// <summary>
/// For debugging purpose.
/// </summary>
public class MySerializationSurrogate : ISerializationSurrogate
{
#region Logging
private static readonly Common.Logging.ILog LOG = Common.Logging.LogManager.GetLogger(typeof(SerializeConversationTestModule));
#endregion
public MySerializationSurrogate()
{
}
#region ISerializationSurrogate Members
public void GetObjectData(object obj, SerializationInfo info, StreamingContext context)
{
if (LOG.IsDebugEnabled)
LOG.Debug(String.Format("MySerializationSurrogateWrapper.GetObjectData({0},...", obj.GetType()));
FieldInfo[] fields = obj.GetType().GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.FlattenHierarchy);
if (obj is ISerializable)
{
((ISerializable)obj).GetObjectData(info, context);
}
else
{
for (int i = 0; i < fields.Length; i++)
{
if ((fields[i].Attributes & FieldAttributes.NotSerialized) == 0)
{
info.AddValue(fields[i].Name, fields[i].GetValue(obj), fields[i].FieldType);
}
}
}
}
public object SetObjectData(object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector)
{
if (LOG.IsDebugEnabled)
LOG.Debug(String.Format("MySerializationSurrogateWrapper.SetObjectData({0},...", obj.GetType()));
FieldInfo[] fields = obj.GetType().GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
for (int i = 0; i < fields.Length; i++)
{
if ((fields[i].Attributes & FieldAttributes.NotSerialized) == 0)
{
fields[i].SetValue(obj, info.GetValue(fields[i].Name, fields[i].FieldType));
}
}
if (obj is IDeserializationCallback)
((IDeserializationCallback)obj).OnDeserialization(obj);
return obj;
}
#endregion
}
}

View File

@@ -0,0 +1 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="SerializeConversationTest.aspx.cs" Inherits="SerializeConversationTest" %>

View File

@@ -0,0 +1,84 @@
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Spring.ConversationWA;
using Spring.Data.NHibernate.Support;
using NHibernate;
using Spring.Entities;
using Spring.Spring.Data.Common;
using NUnit.Framework;
using Spring.Bsn;
using NHibernate.Impl;
using System.Reflection;
using NHibernate.Cfg;
using Spring.Context;
using System.Collections.Generic;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
/// <summary>
/// Page for <see cref="Spring.ConversationWA.WebConversationStateTest.SerializeConversationTest()"/>.
/// </summary>
public partial class SerializeConversationTest : System.Web.UI.Page
{
private IConversationState conversation;
/// <summary>
/// <see cref="IConversationState"/>
/// </summary>
public IConversationState Conversation
{
get { return conversation; }
set { conversation = value; }
}
protected void Page_Load(object sender, EventArgs e)
{
try
{
this.Conversation.StartResumeConversation();
ISession ss = this.Conversation.SessionFactory.GetCurrentSession();
IList<SPCDetailEnt> deatilList = ss.CreateCriteria<SPCDetailEnt>().List<SPCDetailEnt>();
this.Conversation.ConversationManager.PauseConversations();
BinaryFormatter bf = new BinaryFormatter();
MemoryStream ms = new MemoryStream();
System.Collections.ArrayList sessionContent = new System.Collections.ArrayList();
foreach (String keyItem in this.Session.Keys)
{
sessionContent.Add(this.Session[keyItem]);
}
bf.Serialize(ms, sessionContent);
if (this.Session["SPCDetailEnt#1"] == null)
{
//at the first time
this.Session["SPCDetailEnt#1"] = ss.Get<SPCDetailEnt>(1);
}
else
{
//at the second time
if (!Object.ReferenceEquals(this.Session["SPCDetailEnt#1"], ss.Get<SPCDetailEnt>(1)))
throw new InvalidOperationException("!Object.ReferenceEquals(this.Session['SPCDetailEnt#1'], ss.Get<SPCDetailEnt>(1))");
}
Response.Clear();
Response.Write("OK");
}
catch (Exception ex)
{
Response.Clear();
Response.Write(ex.Message + " " + ex.StackTrace);
}
}
}

View File

@@ -30,7 +30,7 @@
<parser type="Spring.Data.Config.DatabaseNamespaceParser, Spring.Data" />
<parser type="Spring.Transaction.Config.TxNamespaceParser, Spring.Data" />
</parsers>
<context name="SpringPrvConctWbApp" type="Spring.Context.Support.WebApplicationContext, Spring.Web">
<context name="SpringConvWbApp" type="Spring.Context.Support.WebApplicationContext, Spring.Web">
<resource uri="~/services.xml.config"/>
</context>
</spring>
@@ -48,6 +48,7 @@
<httpModules>
<add name="NUnitAspExModule" type="NUnitAspEx.AspTestExecutionModule, NUnitAspEx" />
<add name="SerializeConversationTestModule" type="Spring.ConversationWA.SerializeConversationTestModule, Spring.ConversationWA.NH32.Tests"/>
<add name="Spring" type="Spring.Context.Support.WebSupportModule, Spring.Web"/>
<add name="ConversationModule" type="Spring.ConversationWA.HttpModule.ConversationModule, Spring.ConversationWA.NH32"/>
</httpModules>
@@ -62,6 +63,7 @@
<validation validateIntegratedModeConfiguration="false" />
<modules>
<add name="NUnitAspExModule" preCondition="integratedMode" type="NUnitAspEx.AspTestExecutionModule, NUnitAspEx" />
<add name="SerializeConversationTestModule" type="Spring.ConversationWA.SerializeConversationTestModule, Spring.ConversationWA.NH32.Tests"/>
<add name="Spring" preCondition="integratedMode" type="Spring.Context.Support.WebSupportModule, Spring.Web"/>
<add name="ConversationModule" preCondition="integratedMode" type="Spring.ConversationWA.HttpModule.ConversationModule, Spring.ConversationWA.NH32"/>
</modules>

View File

@@ -3,7 +3,7 @@
xmlns:db="http://www.springframework.net/database"
xmlns:tx="http://www.springframework.net/tx">
<!--BEGIN: Teste de Conversation-->
<!--BEGIN: Conversation tests-->
<object type="EndConversationTestBegin.aspx">
<property name="Conversation" ref="convEndConversationTest"></property>
<property name="ConversationEvidenceBsn" expression="@(convEndConversationTest)['conversationEvidenceBsn']"></property>
@@ -116,7 +116,7 @@
<property name="ConversationManager" ref="conversationManager"></property>
<property name="['keyTimeOut']" value="this is the orinal value"></property>
</object>
<!--END: Teste de Conversation-->
<!--END: Conversation tests-->
<object name="HttpApplicationConfigurer" type="Spring.Context.Support.HttpApplicationConfigurer, Spring.Web">
@@ -151,8 +151,8 @@
<property name="Id" value="convSPCLazyLoad"></property>
<property name="TimeOut" value="600000"></property>
<property name="ConversationManager" ref="conversationManager"></property>
<property name="SessionFactory" ref="MySessionFactory"/>
<property name="DbProvider" ref="DbProvider"/>
<property name="SessionFactoryName" value="MySessionFactory"/>
<property name="DbProviderName" value="DbProvider"/>
</object>
<object type="SPCSwitchConversationSameRequest.aspx">
@@ -164,15 +164,15 @@
<property name="Id" value="convSPCSwitchConversationSameRequestA"></property>
<property name="TimeOut" value="600000"></property>
<property name="ConversationManager" ref="conversationManager"></property>
<property name="SessionFactory" ref="MySessionFactory"/>
<property name="DbProvider" ref="DbProvider"/>
<property name="SessionFactoryName" value="MySessionFactory"/>
<property name="DbProviderName" value="DbProvider"/>
</object>
<object name="convSPCSwitchConversationSameRequestB" type="Spring.ConversationWA.Imple.WebConversationSpringState, Spring.ConversationWA.NH32" scope="session">
<property name="Id" value="convSPCSwitchConversationSameRequestB"></property>
<property name="TimeOut" value="600000"></property>
<property name="ConversationManager" ref="conversationManager"></property>
<property name="SessionFactory" ref="MySessionFactory"/>
<property name="DbProvider" ref="DbProvider"/>
<property name="SessionFactoryName" value="MySessionFactory"/>
<property name="DbProviderName" value="DbProvider"/>
</object>
<!--END: session-per-conversation -->
@@ -184,8 +184,8 @@
<property name="Id" value="convRedirectErrorNoPauseConversation"></property>
<property name="TimeOut" value="600000"></property>
<property name="ConversationManager" ref="conversationManager"></property>
<property name="SessionFactory" ref="MySessionFactory"/>
<property name="DbProvider" ref="DbProvider"/>
<property name="SessionFactoryName" value="MySessionFactory"/>
<property name="DbProviderName" value="DbProvider"/>
</object>
<!--BEGIN:RedirectErrorNoPauseConversation-->
@@ -201,8 +201,8 @@
<property name="Id" value="convIoeTestsA"></property>
<property name="TimeOut" value="600000"></property>
<property name="ConversationManager" ref="conversationManager"></property>
<property name="SessionFactory" ref="MySessionFactory"/>
<property name="DbProvider" ref="DbProvider"/>
<property name="SessionFactoryName" value="MySessionFactory"/>
<property name="DbProviderName" value="DbProvider"/>
</object>
<object name="convIoeTestsAA" type="Spring.ConversationWA.Imple.WebConversationSpringState, Spring.ConversationWA.NH32" scope="session">
<property name="Id" value="convIoeTestsAA"></property>
@@ -242,15 +242,15 @@
<property name="Id" value="convASessionIsClosed"></property>
<property name="TimeOut" value="600000"></property>
<property name="ConversationManager" ref="conversationManager"></property>
<property name="SessionFactory" ref="MySessionFactory"/>
<property name="DbProvider" ref="DbProvider"/>
<property name="SessionFactoryName" value="MySessionFactory"/>
<property name="DbProviderName" value="DbProvider"/>
</object>
<object name="convBSessionIsClosed" type="Spring.ConversationWA.Imple.WebConversationSpringState, Spring.ConversationWA.NH32" scope="session">
<property name="Id" value="convBSessionIsClosed"></property>
<property name="TimeOut" value="600000"></property>
<property name="ConversationManager" ref="conversationManager"></property>
<property name="SessionFactory" ref="MySessionFactory"/>
<property name="DbProvider" ref="DbProvider"/>
<property name="SessionFactoryName" value="MySessionFactory"/>
<property name="DbProviderName" value="DbProvider"/>
</object>
<!--END: SessionIsClosed-->
@@ -265,18 +265,18 @@
<property name="Id" value="convAEndPausedSessionIsClosed"></property>
<property name="TimeOut" value="600000"></property>
<property name="ConversationManager" ref="convMngEndPausedSessionIsClosed"></property>
<property name="SessionFactory" ref="MySessionFactory"/>
<property name="DbProvider" ref="DbProvider"/>
<property name="SessionFactoryName" value="MySessionFactory"/>
<property name="DbProviderName" value="DbProvider"/>
</object>
<object name="convBEndPausedSessionIsClosed" type="Spring.ConversationWA.Imple.WebConversationSpringState, Spring.ConversationWA.NH32" scope="session">
<property name="Id" value="convBEndPausedSessionIsClosed"></property>
<property name="TimeOut" value="600000"></property>
<property name="ConversationManager" ref="convMngEndPausedSessionIsClosed"></property>
<property name="SessionFactory" ref="MySessionFactory"/>
<property name="DbProvider" ref="DbProvider"/>
<property name="SessionFactoryName" value="MySessionFactory"/>
<property name="DbProviderName" value="DbProvider"/>
</object>
<object name="convMngEndPausedSessionIsClosed" type="Spring.ConversationWA.Imple.WebConversationManager, Spring.ConversationWA.NH32" scope="session">
<property name="SessionFactory" ref="MySessionFactory"/>
<property name="SessionFactoryName" value="MySessionFactory"/>
<property name="EndPaused" value="true"/>
</object>
<!--END: EndPausedSessionIsClosed-->
@@ -291,17 +291,30 @@
<property name="Id" value="convConnectionReleaseModeIssue"></property>
<property name="TimeOut" value="600000"></property>
<property name="ConversationManager" ref="conversationManager"></property>
<property name="SessionFactory" ref="MySessionFactory"/>
<property name="DbProvider" ref="DbProvider"/>
<property name="SessionFactoryName" value="MySessionFactory"/>
<property name="DbProviderName" value="DbProvider"/>
</object>
<object id="connectionReleaseModeIssueBsn" type="Spring.Bsn.ConnectionReleaseModeIssueBsnImpl, Spring.ConversationWA.NH32.Tests" singleton="true">
<property name="SessionFactory" ref="MySessionFactory"/>
</object>
<!--END: ConnectionReleaseModeIssue-->
<!--BEGIN: SerializeConversationTest-->
<object type="SerializeConversationTest.aspx">
<property name="Conversation" ref="convSerializeConversationTest"/>
</object>
<object name="convSerializeConversationTest" type="Spring.ConversationWA.Imple.WebConversationSpringState, Spring.ConversationWA.NH32" scope="session">
<property name="Id" value="convSerializeConversationTest"></property>
<property name="TimeOut" value="600000"></property>
<property name="ConversationManager" ref="conversationManager"></property>
<property name="SessionFactoryName" value="MySessionFactory"/>
<property name="DbProviderName" value="DbProvider"/>
</object>
<!--END: SerializeConversationTest-->
<!-- BEGIN: Common configuration-->
<object name="conversationManager" type="Spring.ConversationWA.Imple.WebConversationManager, Spring.ConversationWA.NH32" scope="session">
<property name="SessionFactory" ref="MySessionFactory"/>
<property name="SessionFactoryName" value="MySessionFactory"/>
</object>
<object id="transactionManager" type="Spring.Data.NHibernate.HibernateTransactionManager, Spring.Data.NHibernate32">

View File

@@ -48,6 +48,7 @@
<httpModules>
<add name="NUnitAspExModule" type="NUnitAspEx.AspTestExecutionModule, NUnitAspEx" />
<add name="SerializeConversationTestModule" type="Spring.ConversationWA.SerializeConversationTestModule, Spring.ConversationWA.NH32.Tests"/>
<add name="Spring" type="Spring.Context.Support.WebSupportModule, Spring.Web"/>
<add name="ConversationModule" type="Spring.ConversationWA.HttpModule.ConversationModule, Spring.ConversationWA.NH32"/>
</httpModules>
@@ -62,6 +63,7 @@
<validation validateIntegratedModeConfiguration="false" />
<modules>
<add name="NUnitAspExModule" preCondition="integratedMode" type="NUnitAspEx.AspTestExecutionModule, NUnitAspEx" />
<add name="SerializeConversationTestModule" type="Spring.ConversationWA.SerializeConversationTestModule, Spring.ConversationWA.NH32.Tests"/>
<add name="Spring" preCondition="integratedMode" type="Spring.Context.Support.WebSupportModule, Spring.Web"/>
<add name="ConversationModule" preCondition="integratedMode" type="Spring.ConversationWA.HttpModule.ConversationModule, Spring.ConversationWA.NH32"/>
</modules>

View File

@@ -11,6 +11,7 @@ namespace Spring.Entities
/// <see cref="WebConversationStateTest.SPCSwitchConversationSameRequestTest()"/>
/// </summary>
/// <author>Hailton de Castro</author>
[Serializable]
public class SPCDetailEnt
{
private Int32? id;

View File

@@ -11,6 +11,7 @@ namespace Spring.Entities
/// <see cref="WebConversationStateTest.SPCSwitchConversationSameRequestTest()"/>
/// </summary>
/// <author>Hailton de Castro</author>
[Serializable]
public class SPCMasterEnt
{
private Int32? id;

View File

@@ -82,6 +82,7 @@
<Compile Include="ConversationWA\PatialEndConvEndBasePage.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="ConversationWA\SerializeConversationTestModule.cs" />
<Compile Include="ConversationWA\SimpleTest.cs" />
<Compile Include="ConversationWA\WebConversationStateTest.cs" />
<Compile Include="Entities\SPCDetailEnt.cs" />

View File

@@ -30,7 +30,7 @@
<parser type="Spring.Data.Config.DatabaseNamespaceParser, Spring.Data" />
<parser type="Spring.Transaction.Config.TxNamespaceParser, Spring.Data" />
</parsers>
<context name="SpringPrvConctWbApp" type="Spring.Context.Support.WebApplicationContext, Spring.Web">
<context name="SpringConvWbApp" type="Spring.Context.Support.WebApplicationContext, Spring.Web">
<resource uri="~/services.xml.config"/>
</context>
</spring>
@@ -48,6 +48,7 @@
<httpModules>
<add name="NUnitAspExModule" type="NUnitAspEx.AspTestExecutionModule, NUnitAspEx" />
<add name="SerializeConversationTestModule" type="Spring.ConversationWA.SerializeConversationTestModule, Spring.ConversationWA.NH33.Tests"/>
<add name="Spring" type="Spring.Context.Support.WebSupportModule, Spring.Web"/>
<add name="ConversationModule" type="Spring.ConversationWA.HttpModule.ConversationModule, Spring.ConversationWA.NH33"/>
</httpModules>
@@ -62,6 +63,7 @@
<validation validateIntegratedModeConfiguration="false" />
<modules>
<add name="NUnitAspExModule" preCondition="integratedMode" type="NUnitAspEx.AspTestExecutionModule, NUnitAspEx" />
<add name="SerializeConversationTestModule" type="Spring.ConversationWA.SerializeConversationTestModule, Spring.ConversationWA.NH33.Tests"/>
<add name="Spring" preCondition="integratedMode" type="Spring.Context.Support.WebSupportModule, Spring.Web"/>
<add name="ConversationModule" preCondition="integratedMode" type="Spring.ConversationWA.HttpModule.ConversationModule, Spring.ConversationWA.NH33"/>
</modules>

View File

@@ -2,8 +2,8 @@
<objects xmlns="http://www.springframework.net"
xmlns:db="http://www.springframework.net/database"
xmlns:tx="http://www.springframework.net/tx">
<!--BEGIN: Teste de Conversation-->
<!--BEGIN: Conversation tests-->
<object type="EndConversationTestBegin.aspx">
<property name="Conversation" ref="convEndConversationTest"></property>
<property name="ConversationEvidenceBsn" expression="@(convEndConversationTest)['conversationEvidenceBsn']"></property>
@@ -116,7 +116,7 @@
<property name="ConversationManager" ref="conversationManager"></property>
<property name="['keyTimeOut']" value="this is the orinal value"></property>
</object>
<!--END: Teste de Conversation-->
<!--END: Conversation tests-->
<object name="HttpApplicationConfigurer" type="Spring.Context.Support.HttpApplicationConfigurer, Spring.Web">
@@ -151,8 +151,8 @@
<property name="Id" value="convSPCLazyLoad"></property>
<property name="TimeOut" value="600000"></property>
<property name="ConversationManager" ref="conversationManager"></property>
<property name="SessionFactory" ref="MySessionFactory"/>
<property name="DbProvider" ref="DbProvider"/>
<property name="SessionFactoryName" value="MySessionFactory"/>
<property name="DbProviderName" value="DbProvider"/>
</object>
<object type="SPCSwitchConversationSameRequest.aspx">
@@ -164,15 +164,15 @@
<property name="Id" value="convSPCSwitchConversationSameRequestA"></property>
<property name="TimeOut" value="600000"></property>
<property name="ConversationManager" ref="conversationManager"></property>
<property name="SessionFactory" ref="MySessionFactory"/>
<property name="DbProvider" ref="DbProvider"/>
<property name="SessionFactoryName" value="MySessionFactory"/>
<property name="DbProviderName" value="DbProvider"/>
</object>
<object name="convSPCSwitchConversationSameRequestB" type="Spring.ConversationWA.Imple.WebConversationSpringState, Spring.ConversationWA.NH33" scope="session">
<property name="Id" value="convSPCSwitchConversationSameRequestB"></property>
<property name="TimeOut" value="600000"></property>
<property name="ConversationManager" ref="conversationManager"></property>
<property name="SessionFactory" ref="MySessionFactory"/>
<property name="DbProvider" ref="DbProvider"/>
<property name="SessionFactoryName" value="MySessionFactory"/>
<property name="DbProviderName" value="DbProvider"/>
</object>
<!--END: session-per-conversation -->
@@ -184,8 +184,8 @@
<property name="Id" value="convRedirectErrorNoPauseConversation"></property>
<property name="TimeOut" value="600000"></property>
<property name="ConversationManager" ref="conversationManager"></property>
<property name="SessionFactory" ref="MySessionFactory"/>
<property name="DbProvider" ref="DbProvider"/>
<property name="SessionFactoryName" value="MySessionFactory"/>
<property name="DbProviderName" value="DbProvider"/>
</object>
<!--BEGIN:RedirectErrorNoPauseConversation-->
@@ -201,8 +201,8 @@
<property name="Id" value="convIoeTestsA"></property>
<property name="TimeOut" value="600000"></property>
<property name="ConversationManager" ref="conversationManager"></property>
<property name="SessionFactory" ref="MySessionFactory"/>
<property name="DbProvider" ref="DbProvider"/>
<property name="SessionFactoryName" value="MySessionFactory"/>
<property name="DbProviderName" value="DbProvider"/>
</object>
<object name="convIoeTestsAA" type="Spring.ConversationWA.Imple.WebConversationSpringState, Spring.ConversationWA.NH33" scope="session">
<property name="Id" value="convIoeTestsAA"></property>
@@ -242,15 +242,15 @@
<property name="Id" value="convASessionIsClosed"></property>
<property name="TimeOut" value="600000"></property>
<property name="ConversationManager" ref="conversationManager"></property>
<property name="SessionFactory" ref="MySessionFactory"/>
<property name="DbProvider" ref="DbProvider"/>
<property name="SessionFactoryName" value="MySessionFactory"/>
<property name="DbProviderName" value="DbProvider"/>
</object>
<object name="convBSessionIsClosed" type="Spring.ConversationWA.Imple.WebConversationSpringState, Spring.ConversationWA.NH33" scope="session">
<property name="Id" value="convBSessionIsClosed"></property>
<property name="TimeOut" value="600000"></property>
<property name="ConversationManager" ref="conversationManager"></property>
<property name="SessionFactory" ref="MySessionFactory"/>
<property name="DbProvider" ref="DbProvider"/>
<property name="SessionFactoryName" value="MySessionFactory"/>
<property name="DbProviderName" value="DbProvider"/>
</object>
<!--END: SessionIsClosed-->
@@ -265,18 +265,18 @@
<property name="Id" value="convAEndPausedSessionIsClosed"></property>
<property name="TimeOut" value="600000"></property>
<property name="ConversationManager" ref="convMngEndPausedSessionIsClosed"></property>
<property name="SessionFactory" ref="MySessionFactory"/>
<property name="DbProvider" ref="DbProvider"/>
<property name="SessionFactoryName" value="MySessionFactory"/>
<property name="DbProviderName" value="DbProvider"/>
</object>
<object name="convBEndPausedSessionIsClosed" type="Spring.ConversationWA.Imple.WebConversationSpringState, Spring.ConversationWA.NH33" scope="session">
<property name="Id" value="convBEndPausedSessionIsClosed"></property>
<property name="TimeOut" value="600000"></property>
<property name="ConversationManager" ref="convMngEndPausedSessionIsClosed"></property>
<property name="SessionFactory" ref="MySessionFactory"/>
<property name="DbProvider" ref="DbProvider"/>
<property name="SessionFactoryName" value="MySessionFactory"/>
<property name="DbProviderName" value="DbProvider"/>
</object>
<object name="convMngEndPausedSessionIsClosed" type="Spring.ConversationWA.Imple.WebConversationManager, Spring.ConversationWA.NH33" scope="session">
<property name="SessionFactory" ref="MySessionFactory"/>
<property name="SessionFactoryName" value="MySessionFactory"/>
<property name="EndPaused" value="true"/>
</object>
<!--END: EndPausedSessionIsClosed-->
@@ -291,17 +291,30 @@
<property name="Id" value="convConnectionReleaseModeIssue"></property>
<property name="TimeOut" value="600000"></property>
<property name="ConversationManager" ref="conversationManager"></property>
<property name="SessionFactory" ref="MySessionFactory"/>
<property name="DbProvider" ref="DbProvider"/>
<property name="SessionFactoryName" value="MySessionFactory"/>
<property name="DbProviderName" value="DbProvider"/>
</object>
<object id="connectionReleaseModeIssueBsn" type="Spring.Bsn.ConnectionReleaseModeIssueBsnImpl, Spring.ConversationWA.NH33.Tests" singleton="true">
<property name="SessionFactory" ref="MySessionFactory"/>
</object>
<!--END: ConnectionReleaseModeIssue-->
<!--BEGIN: SerializeConversationTest-->
<object type="SerializeConversationTest.aspx">
<property name="Conversation" ref="convSerializeConversationTest"/>
</object>
<object name="convSerializeConversationTest" type="Spring.ConversationWA.Imple.WebConversationSpringState, Spring.ConversationWA.NH33" scope="session">
<property name="Id" value="convSerializeConversationTest"></property>
<property name="TimeOut" value="600000"></property>
<property name="ConversationManager" ref="conversationManager"></property>
<property name="SessionFactoryName" value="MySessionFactory"/>
<property name="DbProviderName" value="DbProvider"/>
</object>
<!--END: SerializeConversationTest-->
<!-- BEGIN: Common configuration-->
<object name="conversationManager" type="Spring.ConversationWA.Imple.WebConversationManager, Spring.ConversationWA.NH33" scope="session">
<property name="SessionFactory" ref="MySessionFactory"/>
<property name="SessionFactoryName" value="MySessionFactory"/>
</object>
<object id="transactionManager" type="Spring.Data.NHibernate.HibernateTransactionManager, Spring.Data.NHibernate33">

View File

@@ -30,7 +30,7 @@
<parser type="Spring.Data.Config.DatabaseNamespaceParser, Spring.Data" />
<parser type="Spring.Transaction.Config.TxNamespaceParser, Spring.Data" />
</parsers>
<context name="SpringPrvConctWbApp" type="Spring.Context.Support.WebApplicationContext, Spring.Web">
<context name="SpringConvWbApp" type="Spring.Context.Support.WebApplicationContext, Spring.Web">
<resource uri="~/services.xml.config"/>
</context>
</spring>
@@ -48,6 +48,7 @@
<httpModules>
<add name="NUnitAspExModule" type="NUnitAspEx.AspTestExecutionModule, NUnitAspEx" />
<add name="SerializeConversationTestModule" type="Spring.ConversationWA.SerializeConversationTestModule, Spring.ConversationWA.NH33.Tests"/>
<add name="Spring" type="Spring.Context.Support.WebSupportModule, Spring.Web"/>
<add name="ConversationModule" type="Spring.ConversationWA.HttpModule.ConversationModule, Spring.ConversationWA.NH33"/>
</httpModules>
@@ -62,6 +63,7 @@
<validation validateIntegratedModeConfiguration="false" />
<modules>
<add name="NUnitAspExModule" preCondition="integratedMode" type="NUnitAspEx.AspTestExecutionModule, NUnitAspEx" />
<add name="SerializeConversationTestModule" type="Spring.ConversationWA.SerializeConversationTestModule, Spring.ConversationWA.NH33.Tests"/>
<add name="Spring" preCondition="integratedMode" type="Spring.Context.Support.WebSupportModule, Spring.Web"/>
<add name="ConversationModule" preCondition="integratedMode" type="Spring.ConversationWA.HttpModule.ConversationModule, Spring.ConversationWA.NH33"/>
</modules>

View File

@@ -97,6 +97,9 @@
<Link>ConversationWA\PatialEndConvEndBasePage.cs</Link>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="..\Spring.ConversationWA.NH32.Tests\ConversationWA\SerializeConversationTestModule.cs">
<Link>ConversationWA\SerializeConversationTestModule.cs</Link>
</Compile>
<Compile Include="..\Spring.ConversationWA.NH32.Tests\ConversationWA\WebConversationStateTest.cs">
<Link>ConversationWA\WebConversationStateTest.cs</Link>
</Compile>
@@ -138,7 +141,6 @@
</ItemGroup>
<ItemGroup>
<None Include="Data\Spring\ConversationWA\WebConversationStateTest\services.xml.config" />
<None Include="Data\Spring\ConversationWA\WebConversationStateTest\web.config.net-1.1" />
<None Include="Data\Spring\ConversationWA\WebConversationStateTest\web.config.net-2.0" />
</ItemGroup>
<ItemGroup>