Updates to make NHibernate 2.0 integration tests pass
This commit is contained in:
@@ -44,8 +44,11 @@ namespace Spring.Data.NHibernate
|
||||
public void SetUp()
|
||||
{
|
||||
BasicConfigurator.Configure();
|
||||
ctx =
|
||||
new XmlApplicationContext("assembly://Spring.Data.NHibernate.Integration.Tests/Spring.Data.NHibernate/dbProviderTemplateTests.xml");
|
||||
#if NH_2_0
|
||||
ctx = new XmlApplicationContext("assembly://Spring.Data.NHibernate20.Integration.Tests/Spring.Data.NHibernate/dbProviderTemplateTests.xml");
|
||||
#else
|
||||
ctx = new XmlApplicationContext("assembly://Spring.Data.NHibernate.Integration.Tests/Spring.Data.NHibernate/dbProviderTemplateTests.xml");
|
||||
#endif
|
||||
userCredentialsDbProvider = ctx["DbProvider"] as UserCredentialsDbProvider;
|
||||
Assert.IsNotNull(userCredentialsDbProvider);
|
||||
|
||||
|
||||
@@ -76,8 +76,11 @@ namespace Spring.Data.NHibernate
|
||||
public void SetUp()
|
||||
{
|
||||
BasicConfigurator.Configure();
|
||||
ctx =
|
||||
new XmlApplicationContext("assembly://Spring.Data.NHibernate.Integration.Tests/Spring.Data.NHibernate/MultipleDbTests.xml");
|
||||
#if NH_2_0
|
||||
ctx = new XmlApplicationContext("assembly://Spring.Data.NHibernate20.Integration.Tests/Spring.Data.NHibernate/MultipleDbTests.xml");
|
||||
#else
|
||||
ctx = new XmlApplicationContext("assembly://Spring.Data.NHibernate.Integration.Tests/Spring.Data.NHibernate/MultipleDbTests.xml");
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -231,10 +231,10 @@ namespace Spring.Data.NHibernate
|
||||
{
|
||||
to = dao.FindByName("Gabriel");
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (Exception)
|
||||
{
|
||||
transactionManager.Rollback(status);
|
||||
throw e;
|
||||
throw;
|
||||
}
|
||||
transactionManager.Commit(status);
|
||||
Assert.IsNotNull(to,"FindByName for Gabriel should not return null");
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
|
||||
<class name="Spring.Data.NHibernate.Debit, Spring.Data.NHibernate20.Integration.Tests"
|
||||
table="Debits" lazy="false">
|
||||
<id name="DebitID" column="DebitID" type="Int32">
|
||||
<generator class="identity" />
|
||||
</id>
|
||||
<property name="Amount" column="DebitAmount"/>
|
||||
</class>
|
||||
</hibernate-mapping>
|
||||
@@ -0,0 +1,129 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<objects xmlns='http://www.springframework.net'
|
||||
xmlns:db="http://www.springframework.net/database">
|
||||
|
||||
<db:provider id="DbProvider1"
|
||||
provider="SqlServer-1.1"
|
||||
connectionString="Data Source=(local);Database=Spring;User ID=springqa;Password=springqa;Trusted_Connection=False"/>
|
||||
|
||||
<db:provider id="DbProvider2"
|
||||
provider="SqlServer-1.1"
|
||||
connectionString="Data Source=(local);Database=Spring;User ID=springqa;Password=springqa;Trusted_Connection=False"/>
|
||||
|
||||
<object id="SessionFactory1" type="Spring.Data.NHibernate.LocalSessionFactoryObject, Spring.Data.NHibernate20">
|
||||
|
||||
<property name="DbProvider" ref="DbProvider1"/>
|
||||
<property name="MappingAssemblies">
|
||||
<list>
|
||||
<value>Spring.Data.NHibernate20.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>
|
||||
|
||||
</object>
|
||||
|
||||
<object id="SessionFactory2" type="Spring.Data.NHibernate.LocalSessionFactoryObject, Spring.Data.NHibernate20">
|
||||
|
||||
<property name="DbProvider" ref="DbProvider2"/>
|
||||
<property name="MappingAssemblies">
|
||||
<list>
|
||||
<value>Spring.Data.NHibernate20.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>
|
||||
|
||||
</object>
|
||||
|
||||
|
||||
<object id="transactionManager"
|
||||
type="Spring.Data.Core.TxScopeTransactionManager, Spring.Data">
|
||||
</object>
|
||||
|
||||
<object id="AccountCreditDao" type="Spring.Data.NHibernate.AccountCreditDao, Spring.Data.NHibernate20.Integration.Tests">
|
||||
<property name="SessionFactory" ref="SessionFactory1"/>
|
||||
</object>
|
||||
<object id="AccountDebitDao" type="Spring.Data.NHibernate.AccountDebitDao, Spring.Data.NHibernate20.Integration.Tests">
|
||||
<property name="SessionFactory" ref="SessionFactory2"/>
|
||||
</object>
|
||||
|
||||
|
||||
<!-- The DAO object that performs multiple data access operations -->
|
||||
<object id="accountManagerTarget"
|
||||
type="Spring.Data.NHibernate.AccountManager, Spring.Data.NHibernate20.Integration.Tests">
|
||||
<property name="AccountCreditDao" ref="AccountCreditDao"/>
|
||||
<property name="AccountDebitDao" ref="AccountDebitDao"/>
|
||||
|
||||
<!--
|
||||
<property name="AuditDao" ref="AuditDao"/>
|
||||
-->
|
||||
|
||||
|
||||
<!--
|
||||
<property name="ThrowException" value="true"/>
|
||||
-->
|
||||
|
||||
<!--
|
||||
<property name="ThrowExceptionAtEnd" value="true"/>
|
||||
-->
|
||||
|
||||
</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">
|
||||
|
||||
<property name="Target" ref="accountManagerTarget"/>
|
||||
|
||||
<property name="InterceptorNames">
|
||||
<value>transactionInterceptor</value>
|
||||
</property>
|
||||
|
||||
</object>
|
||||
|
||||
<!-- Transaction Interceptor based on attribute [Transaction()] -->
|
||||
<object id="transactionInterceptor"
|
||||
type="Spring.Transaction.Interceptor.TransactionInterceptor, Spring.Data">
|
||||
<property name="TransactionManager" ref="transactionManager"/>
|
||||
<!-- 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>
|
||||
@@ -140,11 +140,6 @@
|
||||
<Name>Spring.Data.2005</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\MultipleDbTests.xml">
|
||||
<Link>Data\NHibernate\MultipleDbTests.xml</Link>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Data\NHibernate\dbProviderTemplateTests.xml" />
|
||||
</ItemGroup>
|
||||
@@ -152,10 +147,16 @@
|
||||
<EmbeddedResource Include="Data\NHibernate\templateTests.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Data\NHibernate\Credit.hbm.xml" />
|
||||
<Content Include="Data\NHibernate\NHDAOTests.xml" />
|
||||
<EmbeddedResource Include="Data\NHibernate\Credit.hbm.xml" />
|
||||
<EmbeddedResource Include="Data\NHibernate\NHDAOTests.xml" />
|
||||
<EmbeddedResource Include="Data\NHibernate\TestObject.hbm.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Data\NHibernate\Debit.hbm.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Data\NHibernate\MultipleDbTests.xml" />
|
||||
</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.
|
||||
|
||||
Reference in New Issue
Block a user