SPRNET-1266 - Context creation can throw ObjectCurrentlyInCreatation exception thrown when using <tx:attribute-driven/> with NHibernateTransactionManager
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
|
||||
<PropertyGroup>
|
||||
<ProjectType>Local</ProjectType>
|
||||
<ProductVersion>9.0.21022</ProductVersion>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{AE00E5AB-C39A-436F-86D2-33BFE33E2E40}</ProjectGuid>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
@@ -247,6 +247,7 @@
|
||||
<Compile Include="Transaction\Interceptor\MethodMapTransactionAttributeSource.cs" />
|
||||
<Compile Include="Transaction\Interceptor\NameMatchTransactionAttributeSource.cs" />
|
||||
<Compile Include="Transaction\Interceptor\NoRollbackRuleAttribute.cs" />
|
||||
<Compile Include="Transaction\Interceptor\ObjectFactoryTransactionAttributeSourceAdvisor.cs" />
|
||||
<Compile Include="Transaction\Interceptor\RollbackRuleAttribute.cs" />
|
||||
<Compile Include="Transaction\Interceptor\RuleBasedTransactionAttribute.cs" />
|
||||
<Compile Include="Transaction\Interceptor\TransactionAspectSupport.cs" />
|
||||
@@ -255,6 +256,7 @@
|
||||
<Compile Include="Transaction\Interceptor\TransactionAttributeEditor.cs" />
|
||||
<Compile Include="Transaction\Interceptor\TransactionAttributeSourceAdvisor.cs" />
|
||||
<Compile Include="Transaction\Interceptor\TransactionAttributeSourceEditor.cs" />
|
||||
<Compile Include="Transaction\Interceptor\AbstractTransactionAttributeSourcePointcut.cs" />
|
||||
<Compile Include="Transaction\Interceptor\TransactionInterceptor.cs" />
|
||||
<Compile Include="Transaction\Interceptor\TransactionProxyFactoryObject.cs" />
|
||||
<Compile Include="Transaction\InvalidIsolationLevelException.cs" />
|
||||
|
||||
@@ -65,28 +65,40 @@ namespace Spring.Transaction.Config
|
||||
protected override AbstractObjectDefinition ParseInternal(XmlElement element, ParserContext parserContext)
|
||||
{
|
||||
ConfigureAutoProxyCreator(parserContext, element);
|
||||
|
||||
string transactionManagerName = GetAttributeValue(element, TxNamespaceUtils.TRANSACTION_MANAGER_ATTRIBUTE);
|
||||
Type sourceType = typeof(AttributesTransactionAttributeSource);
|
||||
|
||||
//Create the TransactionAttributeSource
|
||||
RootObjectDefinition sourceDef = new RootObjectDefinition(typeof(AttributesTransactionAttributeSource));
|
||||
sourceDef.Role = ObjectRole.ROLE_INFRASTRUCTURE;
|
||||
string sourceName = parserContext.ReaderContext.RegisterWithGeneratedName(sourceDef);
|
||||
|
||||
//Create the TransactionInterceptor definition.
|
||||
RootObjectDefinition interceptorDefinition = new RootObjectDefinition(typeof(TransactionInterceptor));
|
||||
interceptorDefinition.Role = ObjectRole.ROLE_INFRASTRUCTURE;
|
||||
interceptorDefinition.PropertyValues.Add(TxNamespaceUtils.TRANSACTION_MANAGER_PROPERTY,
|
||||
new RuntimeObjectReference(transactionManagerName));
|
||||
interceptorDefinition.PropertyValues.Add(TxNamespaceUtils.TRANSACTION_ATTRIBUTE_SOURCE,
|
||||
new RootObjectDefinition(sourceType));
|
||||
RegisterTransactionManager(element, interceptorDefinition);
|
||||
interceptorDefinition.PropertyValues.Add(TxNamespaceUtils.TRANSACTION_ATTRIBUTE_SOURCE, new RuntimeObjectReference(sourceName));
|
||||
String interceptorName = parserContext.ReaderContext.RegisterWithGeneratedName(interceptorDefinition);
|
||||
|
||||
//Create the TransactionAttributeSourceAdvisor definition.
|
||||
RootObjectDefinition advisorDefinition = new RootObjectDefinition(typeof(TransactionAttributeSourceAdvisor));
|
||||
advisorDefinition.Role = ObjectRole.ROLE_INFRASTRUCTURE;
|
||||
advisorDefinition.PropertyValues.Add(TRANSACTION_INTERCEPTOR, interceptorDefinition);
|
||||
// Create the TransactionAttributeSourceAdvisor definition.
|
||||
RootObjectDefinition advisorDef = new RootObjectDefinition(typeof(ObjectFactoryTransactionAttributeSourceAdvisor));
|
||||
advisorDef.Role = ObjectRole.ROLE_INFRASTRUCTURE;
|
||||
advisorDef.PropertyValues.Add("transactionAttributeSource", new RuntimeObjectReference(sourceName));
|
||||
advisorDef.PropertyValues.Add("adviceObjectName", interceptorName);
|
||||
|
||||
if (element.HasAttribute(ORDER))
|
||||
{
|
||||
advisorDefinition.PropertyValues.Add(ORDER, GetAttributeValue(element, ORDER));
|
||||
advisorDef.PropertyValues.Add(ORDER, GetAttributeValue(element, ORDER));
|
||||
}
|
||||
|
||||
return advisorDefinition;
|
||||
return advisorDef;
|
||||
}
|
||||
|
||||
private void RegisterTransactionManager(XmlElement element, RootObjectDefinition interceptorDefinition)
|
||||
{
|
||||
string transactionManagerName = GetAttributeValue(element, TxNamespaceUtils.TRANSACTION_MANAGER_ATTRIBUTE);
|
||||
interceptorDefinition.PropertyValues.Add(TxNamespaceUtils.TRANSACTION_MANAGER_PROPERTY,
|
||||
new RuntimeObjectReference(transactionManagerName));
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
#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 System.Reflection;
|
||||
using Spring.Aop.Support;
|
||||
|
||||
namespace Spring.Transaction.Interceptor
|
||||
{
|
||||
public abstract class AbstractTransactionAttributeSourcePointcut : StaticMethodMatcherPointcut
|
||||
{
|
||||
#region Overrides of StaticMethodMatcher
|
||||
|
||||
/// <summary>
|
||||
/// Does the supplied <paramref name="method"/> satisfy this matcher?
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <p>
|
||||
/// Must be implemented by a derived class in order to specify matching
|
||||
/// rules.
|
||||
/// </p>
|
||||
/// </remarks>
|
||||
/// <param name="method">The candidate method.</param>
|
||||
/// <param name="targetType">
|
||||
/// The target <see cref="System.Type"/> (may be <see langword="null"/>,
|
||||
/// in which case the candidate <see cref="System.Type"/> must be taken
|
||||
/// to be the <paramref name="method"/>'s declaring class).
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// <see langword="true"/> if this this method matches statically.
|
||||
/// </returns>
|
||||
public override bool Matches(MethodInfo method, Type targetType)
|
||||
{
|
||||
ITransactionAttributeSource tas = TransactionAttributeSource;
|
||||
return (tas == null || TransactionAttributeSource.ReturnTransactionAttribute(method, targetType) != null);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
protected abstract ITransactionAttributeSource TransactionAttributeSource { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
#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.Aop;
|
||||
using Spring.Aop.Support;
|
||||
|
||||
namespace Spring.Transaction.Interceptor
|
||||
{
|
||||
public class ObjectFactoryTransactionAttributeSourceAdvisor : AbstractObjectFactoryPointcutAdvisor
|
||||
{
|
||||
|
||||
private ITransactionAttributeSource _transactionAttributeSource;
|
||||
private IPointcut _pointcut;
|
||||
|
||||
public ObjectFactoryTransactionAttributeSourceAdvisor()
|
||||
{
|
||||
_pointcut = new TransactonAttributeSourcePointcut(this);
|
||||
}
|
||||
|
||||
|
||||
private class TransactonAttributeSourcePointcut : AbstractTransactionAttributeSourcePointcut
|
||||
{
|
||||
private ObjectFactoryTransactionAttributeSourceAdvisor outer;
|
||||
public TransactonAttributeSourcePointcut(ObjectFactoryTransactionAttributeSourceAdvisor outer)
|
||||
{
|
||||
this.outer = outer;
|
||||
}
|
||||
|
||||
#region Overrides of AbstractTransactionAttributeSourcePointcut
|
||||
|
||||
protected override ITransactionAttributeSource TransactionAttributeSource
|
||||
{
|
||||
get { return outer._transactionAttributeSource; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public ITransactionAttributeSource TransactionAttributeSource
|
||||
{
|
||||
set { _transactionAttributeSource = value; }
|
||||
}
|
||||
|
||||
#region Overrides of AbstractPointcutAdvisor
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="Spring.Aop.IPointcut"/> that drives this advisor.
|
||||
/// </summary>
|
||||
public override IPointcut Pointcut
|
||||
{
|
||||
get { return _pointcut; }
|
||||
set { _pointcut = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -26,9 +26,9 @@ using Spring.Aop.Support;
|
||||
namespace Spring.Transaction.Interceptor
|
||||
{
|
||||
/// <summary>
|
||||
/// Advisor driven by a <see cref="Spring.Transaction.Interceptor.ITransactionAttributeSource"/>, used to exclude
|
||||
/// a <see cref="Spring.Transaction.Interceptor.TransactionInterceptor"/> from methods that
|
||||
/// are non-transactional.
|
||||
/// Advisor driven by a <see cref="Spring.Transaction.Interceptor.ITransactionAttributeSource"/>, used to include
|
||||
/// a <see cref="Spring.Transaction.Interceptor.TransactionInterceptor"/> for methods that
|
||||
/// are transactional.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <p>
|
||||
|
||||
@@ -63,9 +63,17 @@ namespace Spring.Data.NHibernate
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
BasicConfigurator.Configure();
|
||||
//BasicConfigurator.Configure();
|
||||
string assemblyName = GetType().Assembly.GetName().Name;
|
||||
ctx = new XmlApplicationContext("assembly://" + assemblyName + "/Spring.Data.NHibernate/NHDAOTests.xml");
|
||||
//ctx = new XmlApplicationContext("assembly://" + assemblyName + "/Spring.Data.NHibernate/NHDAOTests.xml");
|
||||
string[] contextFiles = new string[]
|
||||
{
|
||||
"assembly://" + assemblyName + "/Spring.Data.NHibernate/Controllers.xml",
|
||||
"assembly://" + assemblyName + "/Spring.Data.NHibernate/Services.xml",
|
||||
"assembly://" + assemblyName + "/Spring.Data.NHibernate/Dao.xml"
|
||||
|
||||
};
|
||||
ctx = new XmlApplicationContext(contextFiles);
|
||||
ctx.Name = AbstractApplicationContext.DefaultRootContextName;
|
||||
|
||||
if (!ContextRegistry.IsContextRegistered(AbstractApplicationContext.DefaultRootContextName))
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<log4net debug="false">
|
||||
|
||||
<!--
|
||||
<appender name="AspNetTraceAppender" type="log4net.Appender.AspNetTraceAppender">
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<conversionPattern value="[%thread] %-5level - %message" />
|
||||
</layout>
|
||||
</appender>
|
||||
-->
|
||||
|
||||
|
||||
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
|
||||
<file value="l:\temp\log.txt" />
|
||||
<appendToFile value="true" />
|
||||
<rollingStyle value="Size" />
|
||||
<maxSizeRollBackups value="10" />
|
||||
<maximumFileSize value="100KB" />
|
||||
<staticLogFileName value="true" />
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<conversionPattern value="%-5level %type{1} - %message%newline" />
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
|
||||
<appender name="TraceAppender" type="log4net.Appender.TraceAppender">
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<conversionPattern value="%-5level %type{1} - %message%newline" />
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
|
||||
<!-- simple appender to get results to UI -->
|
||||
<!--
|
||||
<appender name="MemoryAppender" type="log4net.Appender.MemoryAppender">
|
||||
|
||||
</appender>
|
||||
-->
|
||||
|
||||
|
||||
<!-- Set default logging level to DEBUG -->
|
||||
<root>
|
||||
<level value="TRACE" />
|
||||
<!--<appender-ref ref="AspNetTraceAppender" />-->
|
||||
<appender-ref ref="TraceAppender" />
|
||||
<!--
|
||||
<appender-ref ref="RollingFileAppender" />
|
||||
-->
|
||||
</root>
|
||||
<!--
|
||||
In Spring.NET there is a 1-1 correspondence between the logger name and
|
||||
the namespace of the class doing the logging...
|
||||
-->
|
||||
<logger name="Spring">
|
||||
<level value="TRACE" />
|
||||
</logger>
|
||||
<logger name="NHibernate">
|
||||
<level value="INFO" />
|
||||
</logger>
|
||||
<logger name="Spring.Transaction>">
|
||||
<level value="INFO" />
|
||||
<appender-ref ref="MemoryAppender" />
|
||||
</logger>
|
||||
</log4net>
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
public class AccountController : IAccountController
|
||||
{
|
||||
private IAccountManager accountManager;
|
||||
|
||||
public IAccountManager AccountManager
|
||||
{
|
||||
get { return accountManager; }
|
||||
set { accountManager = value; }
|
||||
}
|
||||
|
||||
#region Implementation of IAccountController
|
||||
|
||||
public void DoWork()
|
||||
{
|
||||
accountManager.DoTransfer(30,30);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<objects xmlns='http://www.springframework.net'
|
||||
xmlns:db="http://www.springframework.net/database"
|
||||
xmlns:tx="http://www.springframework.net/tx">
|
||||
|
||||
|
||||
<object id="accountController" type="Spring.Data.NHibernate.AccountController, Spring.Data.NHibernate21.Integration.Tests">
|
||||
<property name="AccountManager" ref="accountManager"/>
|
||||
</object>
|
||||
|
||||
</objects>
|
||||
@@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<objects xmlns='http://www.springframework.net'
|
||||
xmlns:db="http://www.springframework.net/database"
|
||||
xmlns:tx="http://www.springframework.net/tx">
|
||||
|
||||
<object id="transactionManager"
|
||||
type="Spring.Data.NHibernate.HibernateTransactionManager, Spring.Data.NHibernate21">
|
||||
<!-- Comment out DbProvider if you want to have the tx mgr infer the DbProvider from
|
||||
the session factory. -->
|
||||
<!-- Set the DbProvider explicitly if you would like to have ADO.NET and NHibernate
|
||||
operations take place within the same transaction. -->
|
||||
<!--
|
||||
<property name="DbProvider" ref="DbProvider"/>
|
||||
-->
|
||||
<property name="SessionFactory" ref="SessionFactory"/>
|
||||
|
||||
</object>
|
||||
|
||||
<db:provider id="DbProvider"
|
||||
provider="SqlServer-2.0"
|
||||
connectionString="Data Source=SPRINGQA;Database=Spring;User ID=springqa;Password=springqa;Trusted_Connection=False"/>
|
||||
|
||||
|
||||
<object id="SessionFactory" type="Spring.Data.NHibernate.LocalSessionFactoryObject, Spring.Data.NHibernate21">
|
||||
<property name="DbProvider" ref="DbProvider"/>
|
||||
|
||||
|
||||
<property name="MappingAssemblies">
|
||||
<list>
|
||||
<value>Spring.Data.NHibernate21.Integration.Tests</value>
|
||||
</list>
|
||||
</property>
|
||||
<property name="HibernateProperties">
|
||||
<dictionary>
|
||||
|
||||
<entry key="connection.provider"
|
||||
value="NHibernate.Connection.DriverConnectionProvider"/>
|
||||
|
||||
<entry key="dialect"
|
||||
value="NHibernate.Dialect.MsSql2000Dialect"/>
|
||||
|
||||
<entry key="connection.driver_class"
|
||||
value="NHibernate.Driver.SqlClientDriver"/>
|
||||
|
||||
</dictionary>
|
||||
</property>
|
||||
<!-- provides integation with Spring's declarative transaction management features -->
|
||||
<property name="ExposeTransactionAwareSessionFactory" value="true" />
|
||||
</object>
|
||||
|
||||
<!-- DAOs -->
|
||||
<object id="AccountCreditDao" type="Spring.Data.NHibernate.AccountCreditDao, Spring.Data.NHibernate21.Integration.Tests">
|
||||
<property name="SessionFactory" ref="SessionFactory"/>
|
||||
</object>
|
||||
<object id="AccountDebitDao" type="Spring.Data.NHibernate.AccountDebitDao, Spring.Data.NHibernate21.Integration.Tests">
|
||||
<property name="SessionFactory" ref="SessionFactory"/>
|
||||
</object>
|
||||
|
||||
<object id="AuditDao" type="Spring.Data.NHibernate.AuditDao, Spring.Data.NHibernate21.Integration.Tests">
|
||||
<property name="DbProvider" ref="DbProvider"/>
|
||||
</object>
|
||||
|
||||
</objects>
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
public interface IAccountController
|
||||
{
|
||||
void DoWork();
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<objects xmlns='http://www.springframework.net'
|
||||
xmlns:db="http://www.springframework.net/database">
|
||||
xmlns:db="http://www.springframework.net/database"
|
||||
xmlns:tx="http://www.springframework.net/tx">
|
||||
|
||||
<object id="transactionManager"
|
||||
type="Spring.Data.NHibernate.HibernateTransactionManager, Spring.Data.NHibernate21">
|
||||
<!-- Comment out DbProvider if you want to have the tx mgr infer the DbProvider from
|
||||
the session factory. -->
|
||||
<!-- Set the DbProvider explicitly if you would like to have ADO.NET and NHibernate
|
||||
operations take place within the same transaction. -->
|
||||
<property name="DbProvider" ref="DbProvider"/>
|
||||
<property name="SessionFactory" ref="SessionFactory"/>
|
||||
|
||||
</object>
|
||||
|
||||
<db:provider id="DbProvider"
|
||||
provider="SqlServer-2.0"
|
||||
connectionString="Data Source=SPRINGQA;Database=Spring;User ID=springqa;Password=springqa;Trusted_Connection=False"/>
|
||||
@@ -30,9 +42,11 @@
|
||||
|
||||
</dictionary>
|
||||
</property>
|
||||
|
||||
<!-- provides integation with Spring's declarative transaction management features -->
|
||||
<property name="ExposeTransactionAwareSessionFactory" value="true" />
|
||||
</object>
|
||||
|
||||
<!-- DAOs -->
|
||||
<object id="AccountCreditDao" type="Spring.Data.NHibernate.AccountCreditDao, Spring.Data.NHibernate21.Integration.Tests">
|
||||
<property name="SessionFactory" ref="SessionFactory"/>
|
||||
</object>
|
||||
@@ -44,9 +58,10 @@
|
||||
<property name="DbProvider" ref="DbProvider"/>
|
||||
</object>
|
||||
|
||||
<tx:attribute-driven/>
|
||||
|
||||
<!-- The DAO object that performs multiple data access operations -->
|
||||
<object id="accountManagerTarget"
|
||||
<object id="accountManager"
|
||||
type="Spring.Data.NHibernate.AccountManager, Spring.Data.NHibernate21.Integration.Tests">
|
||||
<property name="AccountCreditDao" ref="AccountCreditDao"/>
|
||||
<property name="AccountDebitDao" ref="AccountDebitDao"/>
|
||||
@@ -66,27 +81,18 @@
|
||||
|
||||
</object>
|
||||
|
||||
<object id="hibernateTransactionManager"
|
||||
type="Spring.Data.NHibernate.HibernateTransactionManager, Spring.Data.NHibernate21">
|
||||
<!-- Comment out DbProvider if you want to have the tx mgr infer the DbProvider from
|
||||
the session factory. -->
|
||||
<!-- Set the DbProvider explicitly if you would like to have ADO.NET and NHibernate
|
||||
operations take place within the same transaction. -->
|
||||
<property name="DbProvider" ref="DbProvider"/>
|
||||
<property name="sessionFactory" ref="SessionFactory"/>
|
||||
<object id="accountController" type="Spring.Data.NHibernate.AccountController, Spring.Data.NHibernate21.Integration.Tests">
|
||||
<property name="AccountManager" ref="accountManager"/>
|
||||
</object>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</object>
|
||||
|
||||
<!-- construct the transaction proxy based on [Transaction()] in DAO class -->
|
||||
<!-- todo condense this xml for attribute usage for ease of use -->
|
||||
<!--
|
||||
<aop:transaction name=testObjectDao"
|
||||
target="NHTestObjectDao"
|
||||
interfaces="Spring.NHibernate.ITestObjectDao"
|
||||
transactionManager="hibernateTransactionManager"/>
|
||||
-->
|
||||
|
||||
<!-- Transactional Proxy for TestObjectManager using the ProxyFactoryObject -->
|
||||
<!--
|
||||
<object id="accountManager"
|
||||
type="Spring.Aop.Framework.ProxyFactoryObject, Spring.Aop">
|
||||
|
||||
@@ -97,15 +103,22 @@
|
||||
</property>
|
||||
|
||||
</object>
|
||||
-->
|
||||
|
||||
<!-- Transaction Interceptor based on attribute [Transaction()] -->
|
||||
|
||||
<!-- note do not have converter from string to this property type registered -->
|
||||
<!--
|
||||
<object id="transactionInterceptor"
|
||||
type="Spring.Transaction.Interceptor.TransactionInterceptor, Spring.Data">
|
||||
<property name="TransactionManager" ref="hibernateTransactionManager"/>
|
||||
<!-- note do not have converter from string to this property type registered -->
|
||||
|
||||
<property name="TransactionAttributeSource">
|
||||
<object type="Spring.Transaction.Interceptor.AttributesTransactionAttributeSource, Spring.Data"/>
|
||||
</property>
|
||||
</object>
|
||||
|
||||
-->
|
||||
|
||||
|
||||
</objects>
|
||||
@@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<objects xmlns='http://www.springframework.net'
|
||||
xmlns:db="http://www.springframework.net/database"
|
||||
xmlns:tx="http://www.springframework.net/tx">
|
||||
|
||||
<tx:attribute-driven/>
|
||||
|
||||
<!-- The DAO object that performs multiple data access operations -->
|
||||
<object id="accountManager"
|
||||
type="Spring.Data.NHibernate.AccountManager, Spring.Data.NHibernate21.Integration.Tests">
|
||||
<property name="AccountCreditDao" ref="AccountCreditDao"/>
|
||||
<property name="AccountDebitDao" ref="AccountDebitDao"/>
|
||||
</object>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Transactional Proxy for TestObjectManager using the ProxyFactoryObject -->
|
||||
<!--
|
||||
<object id="accountManager"
|
||||
type="Spring.Aop.Framework.ProxyFactoryObject, Spring.Aop">
|
||||
|
||||
<property name="Target" ref="accountManagerTarget"/>
|
||||
|
||||
<property name="InterceptorNames">
|
||||
<value>transactionInterceptor</value>
|
||||
</property>
|
||||
|
||||
</object>
|
||||
-->
|
||||
|
||||
<!-- Transaction Interceptor based on attribute [Transaction()] -->
|
||||
|
||||
<!-- note do not have converter from string to this property type registered -->
|
||||
<!--
|
||||
<object id="transactionInterceptor"
|
||||
type="Spring.Transaction.Interceptor.TransactionInterceptor, Spring.Data">
|
||||
<property name="TransactionManager" ref="hibernateTransactionManager"/>
|
||||
|
||||
<property name="TransactionAttributeSource">
|
||||
<object type="Spring.Transaction.Interceptor.AttributesTransactionAttributeSource, Spring.Data"/>
|
||||
</property>
|
||||
</object>
|
||||
|
||||
-->
|
||||
|
||||
|
||||
</objects>
|
||||
@@ -27,7 +27,8 @@ GO
|
||||
CREATE DATABASE NHibernate
|
||||
GO
|
||||
|
||||
CREATE LOGIN [springqa2] WITH PASSWORD=N'springqa2', DEFAULT_DATABASE=[Spring], DEFAULT_LANGUAGE=[us_english]
|
||||
CREATE LOGIN [springqa2] WITH PASSWORD=N'springqa2', DEFAULT_DATABASE=[Spring], DEFAULT_LANGUAGE=[us_english], CHECK_EXPIRATION = OFF, CHECK_POLICY = OFF
|
||||
|
||||
GO
|
||||
|
||||
USE Spring
|
||||
|
||||
@@ -40,6 +40,14 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\lib\Net\2.0\DotNetMock.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Common.Logging.Log4Net, Version=1.2.0.2, Culture=neutral, PublicKeyToken=af08829b84f0328e, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\examples\Spring\Spring.Data.NHibernate.Northwind\lib\net\2.0\Common.Logging.Log4Net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DotNetMock, Version=0.8.1.0, Culture=neutral, PublicKeyToken=65e474d141e25e07">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\lib\Net\2.0\DotNetMock.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Iesi.Collections, Version=1.0.0.3, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\lib\NHibernate21\net\2.0\Iesi.Collections.dll</HintPath>
|
||||
@@ -140,6 +148,8 @@
|
||||
<Compile Include="Data\NHibernate\Bytecode\InjectableUserTypeFixture.cs" />
|
||||
<Compile Include="Data\NHibernate\Bytecode\NHibernateTestImports.cs" />
|
||||
<Compile Include="Data\NHibernate\Bytecode\Product.cs" />
|
||||
<Compile Include="Data\NHibernate\AccountController.cs" />
|
||||
<Compile Include="Data\NHibernate\IAccountController.cs" />
|
||||
<Compile Include="Setup.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -201,6 +211,20 @@
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Config\Log4Net.xml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<EmbeddedResource Include="Data\NHibernate\Dao.xml" />
|
||||
<EmbeddedResource Include="Data\NHibernate\Services.xml" />
|
||||
<EmbeddedResource Include="Data\NHibernate\Controllers.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Data\NHibernate\Bytecode\Foo.Spechbm.xml" />
|
||||
<Content Include="TestEnbeddedConfig.cfg.xml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
@@ -214,4 +238,4 @@
|
||||
xcopy "$(ProjectDir)Data" ..\..\..\..\build\VS.Net.2008\Spring.Data.NHibernate21.Integration.Tests\$(ConfigurationName)\ /y /s /q /d
|
||||
xcopy "$(ProjectDir)$(TargetFileName).config" ..\..\..\..\build\VS.Net.2008\Spring.Data.NHibernate21.Integration.Tests\$(ConfigurationName)\ /y /s /q</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
@@ -41,9 +41,19 @@
|
||||
<arg key="level" value="INFO" />
|
||||
</factoryAdapter>
|
||||
-->
|
||||
<!--
|
||||
<factoryAdapter type="Common.Logging.Simple.TraceLoggerFactoryAdapter, Common.Logging">
|
||||
<arg key="level" value="INFO" />
|
||||
</factoryAdapter>
|
||||
-->
|
||||
|
||||
<factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4Net">
|
||||
<!-- choices are INLINE, FILE, FILE-WATCH, EXTERNAL-->
|
||||
<!-- otherwise BasicConfigurer.Configure is used -->
|
||||
<!-- log4net configuration file is specified with key configFile-->
|
||||
<arg key="configType" value="FILE-WATCH"/>
|
||||
<arg key="configFile" value="~/Config/Log4Net.xml"/>
|
||||
</factoryAdapter>
|
||||
|
||||
</logging>
|
||||
</common>
|
||||
@@ -61,6 +71,7 @@
|
||||
<spring>
|
||||
<parsers>
|
||||
<parser type="Spring.Data.Config.DatabaseNamespaceParser, Spring.Data" />
|
||||
<parser type="Spring.Transaction.Config.TxNamespaceParser, Spring.Data" />
|
||||
</parsers>
|
||||
</spring>
|
||||
|
||||
|
||||
@@ -96,8 +96,8 @@ namespace Spring.Transaction.Config
|
||||
{
|
||||
Assert.IsNotNull(NamespaceParserRegistry.GetParser("http://www.springframework.net/tx"));
|
||||
Assert.IsTrue(ctx.ContainsObjectDefinition(AopNamespaceUtils.AUTO_PROXY_CREATOR_OBJECT_NAME));
|
||||
|
||||
string className = typeof(TransactionAttributeSourceAdvisor).FullName;
|
||||
|
||||
string className = typeof(ObjectFactoryTransactionAttributeSourceAdvisor).FullName;
|
||||
string targetName = className + ObjectDefinitionReaderUtils.GENERATED_OBJECT_NAME_SEPARATOR + "0";
|
||||
|
||||
Assert.IsTrue(ctx.ContainsObjectDefinition(targetName));
|
||||
|
||||
Reference in New Issue
Block a user