diff --git a/Spring.Net.2010.sln b/Spring.Net.2010.sln index 21173b1e..1ee6b799 100644 --- a/Spring.Net.2010.sln +++ b/Spring.Net.2010.sln @@ -105,6 +105,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Data.NHibernate4.Tes EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Data.NHibernate4.Integration.Tests.2010", "test\Spring\Spring.Data.NHibernate4.Integration.Tests\Spring.Data.NHibernate4.Integration.Tests.2010.csproj", "{46F8B5E9-ABCF-4306-BC05-FF05B0FAC151}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests", "test\Spring\Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests\Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests.csproj", "{DE276F7C-4564-49EC-AABC-B964EC3D1626}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|.NET = Debug|.NET @@ -383,26 +385,6 @@ Global {7321149A-47C6-4FBA-9D1A-26FD6815381B}.Release|Any CPU.Build.0 = Release|Any CPU {7321149A-47C6-4FBA-9D1A-26FD6815381B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {7321149A-47C6-4FBA-9D1A-26FD6815381B}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {9F0F739C-876E-4C4B-AA55-9AC9242C25C8}.Debug|.NET.ActiveCfg = Debug|Any CPU - {9F0F739C-876E-4C4B-AA55-9AC9242C25C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9F0F739C-876E-4C4B-AA55-9AC9242C25C8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9F0F739C-876E-4C4B-AA55-9AC9242C25C8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {9F0F739C-876E-4C4B-AA55-9AC9242C25C8}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {9F0F739C-876E-4C4B-AA55-9AC9242C25C8}.Release|.NET.ActiveCfg = Release|Any CPU - {9F0F739C-876E-4C4B-AA55-9AC9242C25C8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9F0F739C-876E-4C4B-AA55-9AC9242C25C8}.Release|Any CPU.Build.0 = Release|Any CPU - {9F0F739C-876E-4C4B-AA55-9AC9242C25C8}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {9F0F739C-876E-4C4B-AA55-9AC9242C25C8}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {C33C6A06-885D-49D2-8029-422D38CBC6D7}.Debug|.NET.ActiveCfg = Debug|Any CPU - {C33C6A06-885D-49D2-8029-422D38CBC6D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C33C6A06-885D-49D2-8029-422D38CBC6D7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C33C6A06-885D-49D2-8029-422D38CBC6D7}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {C33C6A06-885D-49D2-8029-422D38CBC6D7}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {C33C6A06-885D-49D2-8029-422D38CBC6D7}.Release|.NET.ActiveCfg = Release|Any CPU - {C33C6A06-885D-49D2-8029-422D38CBC6D7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C33C6A06-885D-49D2-8029-422D38CBC6D7}.Release|Any CPU.Build.0 = Release|Any CPU - {C33C6A06-885D-49D2-8029-422D38CBC6D7}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {C33C6A06-885D-49D2-8029-422D38CBC6D7}.Release|Mixed Platforms.Build.0 = Release|Any CPU {D546EFB7-9F6C-4C11-B2F8-B85FAD135399}.Debug|.NET.ActiveCfg = Debug|Any CPU {D546EFB7-9F6C-4C11-B2F8-B85FAD135399}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D546EFB7-9F6C-4C11-B2F8-B85FAD135399}.Debug|Any CPU.Build.0 = Debug|Any CPU @@ -475,16 +457,6 @@ Global {FA934E92-C8C2-428A-BE2A-26818F17A787}.Release|.NET.ActiveCfg = Release|Any CPU {FA934E92-C8C2-428A-BE2A-26818F17A787}.Release|Any CPU.ActiveCfg = Release|Any CPU {FA934E92-C8C2-428A-BE2A-26818F17A787}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {CD6A49DE-745C-4360-AADF-3539CFEC6639}.Debug|.NET.ActiveCfg = Debug|Any CPU - {CD6A49DE-745C-4360-AADF-3539CFEC6639}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CD6A49DE-745C-4360-AADF-3539CFEC6639}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CD6A49DE-745C-4360-AADF-3539CFEC6639}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {CD6A49DE-745C-4360-AADF-3539CFEC6639}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {CD6A49DE-745C-4360-AADF-3539CFEC6639}.Release|.NET.ActiveCfg = Release|Any CPU - {CD6A49DE-745C-4360-AADF-3539CFEC6639}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CD6A49DE-745C-4360-AADF-3539CFEC6639}.Release|Any CPU.Build.0 = Release|Any CPU - {CD6A49DE-745C-4360-AADF-3539CFEC6639}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {CD6A49DE-745C-4360-AADF-3539CFEC6639}.Release|Mixed Platforms.Build.0 = Release|Any CPU {6B7DA759-F46D-4860-AF03-E7AC7498E003}.Debug|.NET.ActiveCfg = Debug|Any CPU {6B7DA759-F46D-4860-AF03-E7AC7498E003}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6B7DA759-F46D-4860-AF03-E7AC7498E003}.Debug|Any CPU.Build.0 = Debug|Any CPU @@ -515,16 +487,6 @@ Global {8CF0F34A-CC93-4D87-AE14-A2DEEF072F26}.Release|Any CPU.Build.0 = Release|Any CPU {8CF0F34A-CC93-4D87-AE14-A2DEEF072F26}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {8CF0F34A-CC93-4D87-AE14-A2DEEF072F26}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {64400FF8-2E9F-4809-B5F4-0C7EB8ABFF87}.Debug|.NET.ActiveCfg = Debug|Any CPU - {64400FF8-2E9F-4809-B5F4-0C7EB8ABFF87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {64400FF8-2E9F-4809-B5F4-0C7EB8ABFF87}.Debug|Any CPU.Build.0 = Debug|Any CPU - {64400FF8-2E9F-4809-B5F4-0C7EB8ABFF87}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {64400FF8-2E9F-4809-B5F4-0C7EB8ABFF87}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {64400FF8-2E9F-4809-B5F4-0C7EB8ABFF87}.Release|.NET.ActiveCfg = Release|Any CPU - {64400FF8-2E9F-4809-B5F4-0C7EB8ABFF87}.Release|Any CPU.ActiveCfg = Release|Any CPU - {64400FF8-2E9F-4809-B5F4-0C7EB8ABFF87}.Release|Any CPU.Build.0 = Release|Any CPU - {64400FF8-2E9F-4809-B5F4-0C7EB8ABFF87}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {64400FF8-2E9F-4809-B5F4-0C7EB8ABFF87}.Release|Mixed Platforms.Build.0 = Release|Any CPU {CF375928-B6D5-485C-B04D-2BC41D9DBF1E}.Debug|.NET.ActiveCfg = Debug|Any CPU {CF375928-B6D5-485C-B04D-2BC41D9DBF1E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CF375928-B6D5-485C-B04D-2BC41D9DBF1E}.Debug|Any CPU.Build.0 = Debug|Any CPU @@ -535,16 +497,6 @@ Global {CF375928-B6D5-485C-B04D-2BC41D9DBF1E}.Release|Any CPU.Build.0 = Release|Any CPU {CF375928-B6D5-485C-B04D-2BC41D9DBF1E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {CF375928-B6D5-485C-B04D-2BC41D9DBF1E}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {2FB16852-22AD-4A5B-885A-97136265CC46}.Debug|.NET.ActiveCfg = Debug|Any CPU - {2FB16852-22AD-4A5B-885A-97136265CC46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2FB16852-22AD-4A5B-885A-97136265CC46}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2FB16852-22AD-4A5B-885A-97136265CC46}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {2FB16852-22AD-4A5B-885A-97136265CC46}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {2FB16852-22AD-4A5B-885A-97136265CC46}.Release|.NET.ActiveCfg = Release|Any CPU - {2FB16852-22AD-4A5B-885A-97136265CC46}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2FB16852-22AD-4A5B-885A-97136265CC46}.Release|Any CPU.Build.0 = Release|Any CPU - {2FB16852-22AD-4A5B-885A-97136265CC46}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {2FB16852-22AD-4A5B-885A-97136265CC46}.Release|Mixed Platforms.Build.0 = Release|Any CPU {C57B05EA-FD1A-40EC-BB60-D2E45AB1A86A}.Debug|.NET.ActiveCfg = Debug|Any CPU {C57B05EA-FD1A-40EC-BB60-D2E45AB1A86A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C57B05EA-FD1A-40EC-BB60-D2E45AB1A86A}.Debug|Any CPU.Build.0 = Debug|Any CPU @@ -605,6 +557,16 @@ Global {46F8B5E9-ABCF-4306-BC05-FF05B0FAC151}.Release|Any CPU.Build.0 = Release|Any CPU {46F8B5E9-ABCF-4306-BC05-FF05B0FAC151}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {46F8B5E9-ABCF-4306-BC05-FF05B0FAC151}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {DE276F7C-4564-49EC-AABC-B964EC3D1626}.Debug|.NET.ActiveCfg = Debug|Any CPU + {DE276F7C-4564-49EC-AABC-B964EC3D1626}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DE276F7C-4564-49EC-AABC-B964EC3D1626}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DE276F7C-4564-49EC-AABC-B964EC3D1626}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {DE276F7C-4564-49EC-AABC-B964EC3D1626}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {DE276F7C-4564-49EC-AABC-B964EC3D1626}.Release|.NET.ActiveCfg = Release|Any CPU + {DE276F7C-4564-49EC-AABC-B964EC3D1626}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DE276F7C-4564-49EC-AABC-B964EC3D1626}.Release|Any CPU.Build.0 = Release|Any CPU + {DE276F7C-4564-49EC-AABC-B964EC3D1626}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {DE276F7C-4564-49EC-AABC-B964EC3D1626}.Release|Mixed Platforms.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Spring/Spring.Data.NHibernate/Data/NHibernate/HibernateTxScopeTransactionManager.cs b/src/Spring/Spring.Data.NHibernate/Data/NHibernate/HibernateTxScopeTransactionManager.cs index 9342eee6..fa51c74e 100644 --- a/src/Spring/Spring.Data.NHibernate/Data/NHibernate/HibernateTxScopeTransactionManager.cs +++ b/src/Spring/Spring.Data.NHibernate/Data/NHibernate/HibernateTxScopeTransactionManager.cs @@ -342,10 +342,12 @@ namespace Spring.Data.NHibernate /// protected override bool IsExistingTransaction(object transaction) { - return - ((HibernateTransactionObject)transaction).PromotableTxScopeTransactionObject.TxScopeAdapter. - IsExistingTransaction; - //return ((HibernateTransactionObject) transaction).HasTransaction(); + var hibernateTransactionObject = ((HibernateTransactionObject) transaction); + + var hasExistingPromotableTxScopeTransaction = hibernateTransactionObject.PromotableTxScopeTransactionObject.TxScopeAdapter.IsExistingTransaction; + var hasExistingTransaction = hibernateTransactionObject.HasTransaction(); + + return hasExistingPromotableTxScopeTransaction && hasExistingTransaction; } /// @@ -951,12 +953,14 @@ namespace Spring.Data.NHibernate } */ ISession session = txObject.SessionHolder.Session; + if (txObject.NewSessionHolder) { if (log.IsDebugEnabled) { log.Debug("Closing Hibernate Session [" + session + "] after transaction"); } + SessionFactoryUtils.CloseSessionOrRegisterDeferredClose(session, SessionFactory); } else @@ -970,9 +974,8 @@ namespace Spring.Data.NHibernate session.FlushMode = txObject.SessionHolder.PreviousFlushMode; } } + txObject.SessionHolder.Clear(); - - } private class HibernateTransactionObject : AdoTransactionObjectSupport diff --git a/test/Spring/Spring.Data.Integration.Tests/Data/Spring.Data.Integration.Tests_Spring_database.sql b/test/Spring/Spring.Data.Integration.Tests/Data/Spring.Data.Integration.Tests_Spring_database.sql index 50b2b976..c5464272 100644 Binary files a/test/Spring/Spring.Data.Integration.Tests/Data/Spring.Data.Integration.Tests_Spring_database.sql and b/test/Spring/Spring.Data.Integration.Tests/Data/Spring.Data.Integration.Tests_Spring_database.sql differ diff --git a/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/App.config b/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/App.config new file mode 100644 index 00000000..9fb793b7 --- /dev/null +++ b/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/App.config @@ -0,0 +1,64 @@ + + + + +
+
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/Container.cs b/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/Container.cs new file mode 100644 index 00000000..0c03fe78 --- /dev/null +++ b/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/Container.cs @@ -0,0 +1,10 @@ +using System; + +namespace Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests +{ + public class Container : IContainer + { + public Guid Id { get; set; } + public string Name { get; set; } + } +} diff --git a/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/HibernateTxScopeTransactionManagerNestedTransactionSuspensionTests.cs b/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/HibernateTxScopeTransactionManagerNestedTransactionSuspensionTests.cs new file mode 100644 index 00000000..e4d8df0a --- /dev/null +++ b/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/HibernateTxScopeTransactionManagerNestedTransactionSuspensionTests.cs @@ -0,0 +1,49 @@ +using NUnit.Framework; + +using Spring.Testing.NUnit; + +namespace Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests +{ + [TestFixture] + public class HibernateTxScopeTransactionManagerNestedTransactionSuspensionTests : AbstractTransactionalSpringContextTests + { + #region DI + + public IService1 Service1 { get; set; } + public IService2 Service2 { get; set; } + + #endregion + + protected override string[] ConfigLocations + { + get + { + return new[] + { + "config://spring/objects", + "assembly://Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/Spring.Configuration.xml", + "assembly://Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/Spring.NHibernate.xml", + "assembly://Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/Spring.HibernateTxScopeTransactionManager.xml" + }; + } + } + + [Test] + public void CanSuspendTransactionOnNotSupported() + { + Service1.ServiceMethodWithNotSupported1(); + } + + [Test] + public void CanSuspendTransactionOnNotSupportedWithNestedRequiresNew() + { + Service2.ServiceMethodWithNotSupported(); + } + + [Test] + public void CanSuspendTransactionOnNotSupportedWithNestedRequired() + { + Service1.ServiceMethodWithNotSupported3(); + } + } +} diff --git a/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/IContainer.cs b/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/IContainer.cs new file mode 100644 index 00000000..a8fffcd0 --- /dev/null +++ b/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/IContainer.cs @@ -0,0 +1,10 @@ +using System; + +namespace Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests +{ + public interface IContainer + { + Guid Id { get; set; } + string Name { get; set; } + } +} diff --git a/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/IService1.cs b/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/IService1.cs new file mode 100644 index 00000000..1954d7eb --- /dev/null +++ b/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/IService1.cs @@ -0,0 +1,15 @@ +namespace Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests +{ + public interface IService1 + { + void ServiceMethodWithNotSupported1(); + + void ServiceMethodWithNotSupported2(); + + void ServiceMethodWithNotSupported3(); + + void ServiceMethodWithNotSupported4(); + + void ServiceMethodWithRequired(); + } +} diff --git a/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/IService2.cs b/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/IService2.cs new file mode 100644 index 00000000..9d47a7cb --- /dev/null +++ b/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/IService2.cs @@ -0,0 +1,9 @@ +namespace Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests +{ + public interface IService2 + { + void ServiceMethodWithNotSupported(); + + void ServiceMethodWithRequiresNew(); + } +} diff --git a/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/Mappings.hbm.xml b/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/Mappings.hbm.xml new file mode 100644 index 00000000..25d7f4bd --- /dev/null +++ b/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/Mappings.hbm.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/Properties/AssemblyInfo.cs b/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..23ffdf32 --- /dev/null +++ b/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests")] +[assembly: AssemblyCopyright("Copyright © 2015")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("3f4ca2dc-e2e6-40cc-90d3-0fdda9912e50")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/Service1.cs b/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/Service1.cs new file mode 100644 index 00000000..adf6317e --- /dev/null +++ b/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/Service1.cs @@ -0,0 +1,45 @@ +using Spring.Data.NHibernate.Generic; +using Spring.Transaction; + +namespace Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests +{ + [Transaction.Interceptor.Transaction(TransactionPropagation.Supports, ReadOnly = true)] + public class Service1 : IService1 + { + #region DI + + public Generic.HibernateTemplate HibernateTemplate { get; set; } + + #endregion + + [Transaction.Interceptor.Transaction(TransactionPropagation.NotSupported)] + public virtual void ServiceMethodWithNotSupported1() + { + ServiceMethodWithNotSupported2(); + } + + [Transaction.Interceptor.Transaction(TransactionPropagation.NotSupported)] + public virtual void ServiceMethodWithNotSupported2() + { + // do some stuff + } + + [Transaction.Interceptor.Transaction(TransactionPropagation.NotSupported)] + public virtual void ServiceMethodWithNotSupported3() + { + ServiceMethodWithNotSupported4(); + } + + [Transaction.Interceptor.Transaction(TransactionPropagation.NotSupported)] + public virtual void ServiceMethodWithNotSupported4() + { + ServiceMethodWithRequired(); + } + + [Transaction.Interceptor.Transaction(TransactionPropagation.Required)] + public virtual void ServiceMethodWithRequired() + { + // do some stuff + } + } +} diff --git a/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/Service2.cs b/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/Service2.cs new file mode 100644 index 00000000..d2052dbc --- /dev/null +++ b/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/Service2.cs @@ -0,0 +1,27 @@ +using Spring.Data.NHibernate.Generic; +using Spring.Transaction; + +namespace Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests +{ + [Transaction.Interceptor.Transaction(TransactionPropagation.Supports, ReadOnly = true)] + public class Service2 : IService2 + { + #region DI + + public Generic.HibernateTemplate HibernateTemplate { get; set; } + + #endregion + + [Transaction.Interceptor.Transaction(TransactionPropagation.NotSupported)] + public virtual void ServiceMethodWithNotSupported() + { + ServiceMethodWithRequiresNew(); + } + + [Transaction.Interceptor.Transaction(TransactionPropagation.RequiresNew)] + public virtual void ServiceMethodWithRequiresNew() + { + // do stuff + } + } +} diff --git a/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/Spring.Configuration.xml b/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/Spring.Configuration.xml new file mode 100644 index 00000000..ae42f85f --- /dev/null +++ b/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/Spring.Configuration.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + *Service* + + + + + transactionAdvice + + + + + + + + + + + + diff --git a/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests.csproj b/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests.csproj new file mode 100644 index 00000000..8bcde6a1 --- /dev/null +++ b/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests.csproj @@ -0,0 +1,108 @@ + + + + + Debug + AnyCPU + {DE276F7C-4564-49EC-AABC-B964EC3D1626} + Library + Properties + Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests + Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests + v4.5 + 512 + + + true + full + false + ..\..\..\build\VS.Net.2010\Spring.Data.NestedTxSuspension.Integration.Tests\Debug\ + TRACE;DEBUG;NET_4_0 + prompt + 4 + + + pdbonly + true + ..\..\..\build\VS.Net.2010\Spring.Data.NestedTxSuspension.Integration.Tests\Release\ + TRACE;NET_4_0 + prompt + 4 + + + + False + ..\..\..\packages\Common.Logging.3.0.0\lib\net40\Common.Logging.dll + + + False + ..\..\..\packages\Common.Logging.Core.3.0.0\lib\net40\Common.Logging.Core.dll + + + ..\..\..\packages\NHibernate.4.0.3.4000\lib\net40\NHibernate.dll + + + False + ..\..\..\packages\NUnit.2.6.3\lib\nunit.framework.dll + + + + + + + + + + + + + + + + + + + + + + + {3a3a4e65-45a6-4b20-b460-0bedc302c02c} + Spring.Aop.2010 + + + {710961A3-0DF4-49E4-A26E-F5B9C044AC84} + Spring.Core.2010 + + + {d9c45177-0d80-4133-ab46-58f142db92aa} + Spring.Data.NHibernate4.2010 + + + {ae00e5ab-c39a-436f-86d2-33bfe33e2e40} + Spring.Data.2010 + + + {ed204a7b-832f-44c7-bfe3-504aebe1bcc8} + Spring.Testing.NUnit.2010 + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/Spring.HibernateTxScopeTransactionManager.xml b/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/Spring.HibernateTxScopeTransactionManager.xml new file mode 100644 index 00000000..d4d6fa3b --- /dev/null +++ b/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/Spring.HibernateTxScopeTransactionManager.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/Spring.NHibernate.xml b/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/Spring.NHibernate.xml new file mode 100644 index 00000000..6e31c2c7 --- /dev/null +++ b/test/Spring/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/Spring.NHibernate.xml @@ -0,0 +1,41 @@ + + + Dependency Injection for NHibernate Session + + + + + + + + + + + + + + + + + + + + + + + + + + + assembly://Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/Spring.Data.NHibernate.NestedTxSuspension.Integration.Tests/Mappings.hbm.xml + + + + + + + + + + + \ No newline at end of file