remove obsolete library support
* ASP.NET MVC 3 * ASP.NET MVC 4 * NHibernate 3 * NHibernate 4
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net452</TargetFrameworks>
|
||||
<TargetFrameworks>netcoreapp2.1;$(TargetFullFrameworkVersion)</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Aop\Spring.Aop.csproj" />
|
||||
@@ -16,17 +16,17 @@
|
||||
<PackageReference Include="NUnit" Version="$(NUnitVersion)" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="$(NUnitTestAdapterVersion)" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System.configuration" />
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == '$(TargetFullFrameworkVersion)' ">
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Data.OracleClient" />
|
||||
<Reference Include="System.Transactions" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.1' ">
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.5.1" Condition=" '$(TargetFramework)' == 'netcoreapp2.1' " />
|
||||
<Compile Remove="Data\SQLiteTests.cs" />
|
||||
<Compile Remove="Data\OracleAdoTemplateTests.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Data\DTC1.1AppContext.xml" />
|
||||
<Content Include="Data\Spring.Data.Integration.Tests_CreditsAndDebits_database.sql" />
|
||||
<Content Include="Data\Spring.Data.Integration.Tests_Credits_database.sql" />
|
||||
<Content Include="Data\Spring.Data.Integration.Tests_Debits_database.sql" />
|
||||
<Content Include="Data\Spring.Data.Integration.Tests_Spring_database.sql" />
|
||||
<EmbeddedResource Include="Data\*.xml" />
|
||||
<EmbeddedResource Include="Data\Generic\GenericAdoTemplateTests.xml" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
[assembly: AssemblyTitle("Spring.Data.NHibernate Integration Tests")]
|
||||
[assembly: AssemblyDescription("Integration tests for Spring.Data.NHibernate assembly")]
|
||||
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
|
||||
assembly="uNhAddIns.Adapters.CommonTests"
|
||||
namespace="uNhAddIns.Adapters.CommonTests.EnhancedBytecodeProvider">
|
||||
|
||||
<typedef name="SpecialString"
|
||||
class="InjectableStringUserType"/>
|
||||
|
||||
<class name ="Foo">
|
||||
<id type="int">
|
||||
<generator class="hilo"/>
|
||||
</id>
|
||||
<property name="Description" type="SpecialString" />
|
||||
</class>
|
||||
</hibernate-mapping>
|
||||
@@ -1,114 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<section name="hibernate-configuration"
|
||||
type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />
|
||||
<section name="log4net"
|
||||
type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
|
||||
</configSections>
|
||||
|
||||
<connectionStrings>
|
||||
<add name="TestConnectionString"
|
||||
connectionString="TestConnectionString-TestConnectionString" />
|
||||
</connectionStrings>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"
|
||||
applies-to="v1.1.4322">
|
||||
<qualifyAssembly partialName="System.Web"
|
||||
fullName="System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
</assemblyBinding>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"
|
||||
applies-to="v2.0.50727">
|
||||
<qualifyAssembly partialName="System.Web"
|
||||
fullName="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
</assemblyBinding>
|
||||
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<!-- The assembly binding for FirebirdClient ADO.NET 2.0 DataProvider -->
|
||||
<qualifyAssembly partialName="FirebirdSql.Data.FirebirdClient" fullName="FirebirdSql.Data.FirebirdClient, Version=2.1.0.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c" />
|
||||
|
||||
<!-- Spring.NET uses a new version of NUnit -->
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="2.5.7.10213"/>
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
|
||||
</runtime>
|
||||
|
||||
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
|
||||
<bytecode-provider type="lcg"/>
|
||||
<reflection-optimizer use="true"/>
|
||||
<session-factory name="NHibernate.Test">
|
||||
<property name="connection.provider">NHibernate.Test.DebugConnectionProvider, NHibernate.Test</property>
|
||||
<property name="cache.provider_class">NHibernate.Cache.HashtableCacheProvider, NHibernate</property>
|
||||
<property name="cache.use_query_cache">true</property>
|
||||
<property name="query.startup_check">false</property>
|
||||
<!--
|
||||
The valid strings for Isolation can be found in the documentation for the System.Data.IsolationLevel
|
||||
Enumeration documentation.
|
||||
Use the member names - not the values.
|
||||
-->
|
||||
<property name="adonet.batch_size">10</property>
|
||||
<property name="connection.isolation">ReadCommitted</property>
|
||||
<property name="hbm2ddl.keywords">none</property>
|
||||
<property name="format_sql">true</property>
|
||||
|
||||
<!-- This is the System.Data.dll provider for MSSQL Server -->
|
||||
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
|
||||
<property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
|
||||
<property name="connection.connection_string">Server=SPRINGQA;initial catalog=nhibernate;Integrated Security=SSPI</property>
|
||||
|
||||
<property name="show_sql">false</property>
|
||||
<property name="use_outer_join">true</property>
|
||||
<property name="command_timeout">444</property>
|
||||
<property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
|
||||
<property name="adonet.wrap_result_sets">false</property>
|
||||
|
||||
<!-- <property name="proxyfactory.factory_class">NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property>-->
|
||||
<property name="proxyfactory.factory_class">Spring.Data.NHibernate.Bytecode.ProxyFactoryFactory, Spring.Data.NHibernate21</property>
|
||||
</session-factory>
|
||||
</hibernate-configuration>
|
||||
|
||||
<log4net>
|
||||
<!-- Define some output appenders -->
|
||||
<appender name="trace"
|
||||
type="log4net.Appender.TraceAppender, log4net">
|
||||
<layout type="log4net.Layout.PatternLayout,log4net">
|
||||
<param name="ConversionPattern"
|
||||
value="%d{ABSOLUTE} %-5p %c{1}:%L - %m%n" />
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<appender name="console"
|
||||
type="log4net.Appender.ConsoleAppender, log4net">
|
||||
<layout type="log4net.Layout.PatternLayout,log4net">
|
||||
<param name="ConversionPattern"
|
||||
value="%d{ABSOLUTE} %-5p %c{1}:%L - %m%n" />
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<root>
|
||||
<priority value="WARN" />
|
||||
<appender-ref ref="trace" />
|
||||
<appender-ref ref="console" />
|
||||
</root>
|
||||
|
||||
<logger name="NHibernate.Hql.Ast.ANTLR">
|
||||
<priority value="OFF" />
|
||||
</logger>
|
||||
|
||||
<logger name="NHibernate.SQL">
|
||||
<level value="OFF" />
|
||||
</logger>
|
||||
|
||||
<logger name="NHibernate.AdoNet.AbstractBatcher">
|
||||
<level value="OFF" />
|
||||
</logger>
|
||||
|
||||
<logger name="NHibernate.Tool.hbm2ddl.SchemaExport">
|
||||
<level value="ERROR" />
|
||||
</logger>
|
||||
|
||||
</log4net>
|
||||
</configuration>
|
||||
@@ -1,60 +0,0 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright 2002-2010 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 NUnit.Framework;
|
||||
using Spring.Core.IO;
|
||||
using Spring.Data.Common;
|
||||
using Spring.Data.Core;
|
||||
using Spring.Testing.Ado;
|
||||
|
||||
namespace Spring
|
||||
{
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
/// <author>Erich Eichinger</author>
|
||||
[SetUpFixture]
|
||||
public class Setup
|
||||
{
|
||||
private const string DBConnection = "Data Source=SPRINGQA;Database=$DATABASE$;Trusted_Connection=False;User ID=springqa;Password=springqa";
|
||||
private readonly IResourceLoader resourceLoader = new ConfigurableResourceLoader();
|
||||
|
||||
private IResource GetResource(object instance, string name)
|
||||
{
|
||||
string resourcePath = TestResourceLoader.GetAssemblyResourceUri(instance, name);
|
||||
return resourceLoader.GetResource(resourcePath);
|
||||
}
|
||||
|
||||
[SetUp]
|
||||
public void InstallMSSQLDatabase()
|
||||
{
|
||||
IDbProvider dbProvider = DbProviderFactory.GetDbProvider("SqlServer-2.0");
|
||||
AdoTemplate ado = new AdoTemplate(dbProvider);
|
||||
|
||||
// (re-)create database(s)
|
||||
dbProvider.ConnectionString = DBConnection.Replace("$DATABASE$", "master");
|
||||
SimpleAdoTestUtils.ExecuteSqlScript(ado, GetResource(this, "RecreateDatabases.sql"));
|
||||
|
||||
// create tables
|
||||
dbProvider.ConnectionString = DBConnection.Replace("$DATABASE$", "Spring");
|
||||
SimpleAdoTestUtils.ExecuteSqlScript(ado, GetResource(this, "Data.NHibernate/creditdebit.sql"));
|
||||
SimpleAdoTestUtils.ExecuteSqlScript(ado, GetResource(this, "Data.NHibernate/testObject.sql"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="common">
|
||||
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
|
||||
</sectionGroup>
|
||||
<sectionGroup name="spring">
|
||||
<section name="parsers" type="Spring.Context.Support.NamespaceParsersSectionHandler, Spring.Core" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
|
||||
<common>
|
||||
<logging>
|
||||
|
||||
<factoryAdapter type="Common.Logging.Simple.ConsoleOutLoggerFactoryAdapter, Common.Logging">
|
||||
<arg key="level" value="DEBUG" />
|
||||
|
||||
</factoryAdapter>
|
||||
|
||||
</logging>
|
||||
</common>
|
||||
|
||||
<!--
|
||||
<common>
|
||||
<logging>
|
||||
<factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4Net129">
|
||||
<arg key="configType" value="EXTERNAL" />
|
||||
</factoryAdapter>
|
||||
</logging>
|
||||
</common>
|
||||
-->
|
||||
|
||||
<spring>
|
||||
<parsers>
|
||||
<parser type="Spring.Data.Config.DatabaseNamespaceParser, Spring.Data" />
|
||||
</parsers>
|
||||
</spring>
|
||||
|
||||
</configuration>
|
||||
@@ -1,5 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
[assembly: AssemblyTitle("Spring.Data.NHibernate Integration Tests")]
|
||||
[assembly: AssemblyDescription("Integration tests for Spring.Data.NHibernate assembly")]
|
||||
@@ -1,30 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="common">
|
||||
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
|
||||
</sectionGroup>
|
||||
<sectionGroup name="spring">
|
||||
<section name="parsers" type="Spring.Context.Support.NamespaceParsersSectionHandler, Spring.Core" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
|
||||
<!--
|
||||
<common>
|
||||
<logging>
|
||||
<factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4Net129">
|
||||
<arg key="configType" value="EXTERNAL" />
|
||||
</factoryAdapter>
|
||||
</logging>
|
||||
</common>
|
||||
-->
|
||||
|
||||
<spring>
|
||||
<parsers>
|
||||
<parser type="Spring.Data.Config.DatabaseNamespaceParser, Spring.Data"/>
|
||||
<parser type="Spring.Transaction.Config.TxNamespaceParser, Spring.Data" />
|
||||
<parser type="Spring.Aop.Config.AopNamespaceParser, Spring.Aop" />
|
||||
</parsers>
|
||||
</spring>
|
||||
|
||||
</configuration>
|
||||
@@ -1,39 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="common">
|
||||
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
|
||||
</sectionGroup>
|
||||
<sectionGroup name="spring">
|
||||
<section name="parsers" type="Spring.Context.Support.NamespaceParsersSectionHandler, Spring.Core" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
|
||||
|
||||
<common>
|
||||
<logging>
|
||||
|
||||
<factoryAdapter type="Common.Logging.Simple.ConsoleOutLoggerFactoryAdapter, Common.Logging">
|
||||
<arg key="level" value="WARN" />
|
||||
</factoryAdapter>
|
||||
|
||||
</logging>
|
||||
</common>
|
||||
|
||||
<!--
|
||||
<common>
|
||||
<logging>
|
||||
<factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4Net129">
|
||||
<arg key="configType" value="EXTERNAL" />
|
||||
</factoryAdapter>
|
||||
</logging>
|
||||
</common>
|
||||
-->
|
||||
|
||||
<spring>
|
||||
<parsers>
|
||||
<parser type="Spring.Data.Config.DatabaseNamespaceParser, Spring.Data" />
|
||||
</parsers>
|
||||
</spring>
|
||||
|
||||
</configuration>
|
||||
@@ -1,4 +0,0 @@
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyTitle("Spring.Data.NHibernate3 Integration Tests")]
|
||||
[assembly: AssemblyDescription("Integration tests for Spring.Data.NHibernate3 assembly")]
|
||||
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
|
||||
assembly="uNhAddIns.Adapters.CommonTests"
|
||||
namespace="uNhAddIns.Adapters.CommonTests.EnhancedBytecodeProvider">
|
||||
|
||||
<typedef name="SpecialString"
|
||||
class="InjectableStringUserType"/>
|
||||
|
||||
<class name ="Foo">
|
||||
<id type="int">
|
||||
<generator class="hilo"/>
|
||||
</id>
|
||||
<property name="Description" type="SpecialString" />
|
||||
</class>
|
||||
</hibernate-mapping>
|
||||
@@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
|
||||
<class name="Spring.Data.NHibernate.Credit, Spring.Data.NHibernate3.Integration.Tests"
|
||||
table="Credits" lazy="false">
|
||||
<id name="CreditID" column="CreditID" type="Int32">
|
||||
<generator class="identity" />
|
||||
</id>
|
||||
<property name="Amount" column="CreditAmount"/>
|
||||
</class>
|
||||
</hibernate-mapping>
|
||||
@@ -1,63 +0,0 @@
|
||||
<?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.NHibernate3">
|
||||
<!-- 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.NHibernate3">
|
||||
<property name="DbProvider" ref="DbProvider"/>
|
||||
|
||||
|
||||
<property name="MappingAssemblies">
|
||||
<list>
|
||||
<value>Spring.Data.NHibernate3.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">
|
||||
<property name="SessionFactory" ref="SessionFactory"/>
|
||||
</object>
|
||||
<object id="AccountDebitDao" type="Spring.Data.NHibernate.AccountDebitDao">
|
||||
<property name="SessionFactory" ref="SessionFactory"/>
|
||||
</object>
|
||||
|
||||
<object id="AuditDao" type="Spring.Data.NHibernate.AuditDao">
|
||||
<property name="DbProvider" ref="DbProvider"/>
|
||||
</object>
|
||||
|
||||
</objects>
|
||||
@@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
|
||||
<class name="Spring.Data.NHibernate.Debit, Spring.Data.NHibernate3.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>
|
||||
@@ -1,129 +0,0 @@
|
||||
<?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.NHibernate3">
|
||||
|
||||
<property name="DbProvider" ref="DbProvider1"/>
|
||||
<property name="MappingAssemblies">
|
||||
<list>
|
||||
<value>Spring.Data.NHibernate3.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.NHibernate3">
|
||||
|
||||
<property name="DbProvider" ref="DbProvider2"/>
|
||||
<property name="MappingAssemblies">
|
||||
<list>
|
||||
<value>Spring.Data.NHibernate3.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.NHibernate3.Integration.Tests">
|
||||
<property name="SessionFactory" ref="SessionFactory1"/>
|
||||
</object>
|
||||
<object id="AccountDebitDao" type="Spring.Data.NHibernate.AccountDebitDao, Spring.Data.NHibernate3.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.NHibernate3.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>
|
||||
@@ -1,122 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<objects xmlns='http://www.springframework.net'
|
||||
xmlns:db="http://www.springframework.net/database">
|
||||
|
||||
<db:provider id="DbProvider"
|
||||
provider="SqlServer-1.1"
|
||||
connectionString="Data Source=(local);Database=Spring;User ID=springqa;Password=springqa;Trusted_Connection=False"/>
|
||||
|
||||
<!--
|
||||
<db:provider id="DbProvider"
|
||||
provider="System.Data.SqlClient"
|
||||
connectionString="Data Source=MARKT60\SQL2005;Initial Catalog=CreditsAndDebits;User ID=springqa;Password=springqa"/>
|
||||
-->
|
||||
|
||||
<object id="SessionFactory" type="Spring.Data.NHibernate.LocalSessionFactoryObject, Spring.Data.NHibernate3">
|
||||
<property name="DbProvider" ref="DbProvider"/>
|
||||
|
||||
|
||||
<property name="MappingAssemblies">
|
||||
<list>
|
||||
<value>Spring.Data.NHibernate3.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"/>
|
||||
|
||||
<!--
|
||||
<entry key="proxyfactory.factory_class"
|
||||
value="NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu"/>
|
||||
-->
|
||||
|
||||
|
||||
</dictionary>
|
||||
</property>
|
||||
|
||||
</object>
|
||||
|
||||
<object id="AccountCreditDao" type="Spring.Data.NHibernate.AccountCreditDao, Spring.Data.NHibernate3.Integration.Tests">
|
||||
<property name="SessionFactory" ref="SessionFactory"/>
|
||||
</object>
|
||||
<object id="AccountDebitDao" type="Spring.Data.NHibernate.AccountDebitDao, Spring.Data.NHibernate3.Integration.Tests">
|
||||
<property name="SessionFactory" ref="SessionFactory"/>
|
||||
</object>
|
||||
|
||||
<object id="AuditDao" type="Spring.Data.NHibernate.AuditDao, Spring.Data.NHibernate3.Integration.Tests">
|
||||
<property name="DbProvider" ref="DbProvider"/>
|
||||
</object>
|
||||
|
||||
|
||||
<!-- The DAO object that performs multiple data access operations -->
|
||||
<object id="accountManagerTarget"
|
||||
type="Spring.Data.NHibernate.AccountManager, Spring.Data.NHibernate3.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>
|
||||
|
||||
<object id="hibernateTransactionManager"
|
||||
type="Spring.Data.NHibernate.HibernateTransactionManager, Spring.Data.NHibernate3">
|
||||
<!-- 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>
|
||||
|
||||
<!-- 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="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>
|
||||
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
|
||||
<class name="Spring.Data.NHibernate.TestObject, Spring.Data.NHibernate3.Integration.Tests" table="TestObjects">
|
||||
<id name="ObjectNumber" column="TestObjectNo" type="Int32">
|
||||
<generator class="identity" />
|
||||
|
||||
<!--
|
||||
<generator class="sequence">
|
||||
<param name="sequence">ID_SEQ</param>
|
||||
</generator>
|
||||
-->
|
||||
|
||||
</id>
|
||||
<property name="Age" column="Age" type="Int32"/>
|
||||
<property name="Name" type="String" length="50"/>
|
||||
</class>
|
||||
</hibernate-mapping>
|
||||
@@ -1,110 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<objects xmlns='http://www.springframework.net'
|
||||
xmlns:db="http://www.springframework.net/database">
|
||||
|
||||
<!--
|
||||
<db:provider id="DbProvider"
|
||||
provider="SqlServer-1.1"
|
||||
connectionString="Data Source=MARKT60\SQL2005;Database=Spring;User ID=springqa;Password=springqa;Trusted_Connection=False"/>
|
||||
-->
|
||||
|
||||
<object id="DbProvider" type="Spring.Data.Common.UserCredentialsDbProvider, Spring.Data">
|
||||
<property name="TargetDbProvider" ref="targetDbProvider"/>
|
||||
<property name="Username" value="User ID=springqa"/>
|
||||
<property name="Password" value="Password=springqa"/>
|
||||
</object>
|
||||
|
||||
<db:provider id="targetDbProvider"
|
||||
provider="SqlServer-2.0"
|
||||
connectionString="Data Source=(local);Database=Spring;Trusted_Connection=False"/>
|
||||
|
||||
|
||||
<db:provider id="standardDbProvider"
|
||||
provider="SqlServer-2.0"
|
||||
connectionString="Data Source=(local);Database=Spring;Trusted_Connection=False;User ID=springqa;Password=springqa"/>
|
||||
|
||||
|
||||
|
||||
<object id="SessionFactory" type="Spring.Data.NHibernate.LocalSessionFactoryObject, Spring.Data.NHibernate3">
|
||||
<property name="DbProvider" ref="DbProvider"/>
|
||||
<property name="MappingResources">
|
||||
<list>
|
||||
<value>assembly://Spring.Data.NHibernate3.Integration.Tests/Spring.Data.NHibernate/TestObject.hbm.xml</value>
|
||||
</list>
|
||||
</property>
|
||||
<!--
|
||||
<property name="MappingAssemblies">
|
||||
<list>
|
||||
<value>Spring.Data.NHibernate.Integration.Tests</value>
|
||||
</list>
|
||||
</property>
|
||||
-->
|
||||
<property name="HibernateProperties">
|
||||
<dictionary>
|
||||
<!-- use connection provided by DbProvider
|
||||
<entry key="hibernate.connection.provider"
|
||||
value="NHibernate.Connection.DriverConnectionProvider"/>
|
||||
-->
|
||||
<entry key="dialect"
|
||||
value="NHibernate.Dialect.MsSql2000Dialect"/>
|
||||
|
||||
<entry key="connection.driver_class"
|
||||
value="NHibernate.Driver.SqlClientDriver"/>
|
||||
|
||||
<!--
|
||||
<entry key="hibernate.dialect"
|
||||
value="NHibernate.Dialect.Oracle9Dialect"/>
|
||||
-->
|
||||
|
||||
<!--
|
||||
<entry key="proxyfactory.factory_class"
|
||||
value="NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu"/>
|
||||
-->
|
||||
</dictionary>
|
||||
</property>
|
||||
|
||||
</object>
|
||||
|
||||
<!--
|
||||
<object id="nativeNHTestObjectDao" type="Spring.Data.NHibernate.NativeNHTestObjectDao, Spring.Data.NHibernate.Integration.Tests">
|
||||
<property name="SessionFactory" ref="SessionFactory"/>
|
||||
</object>
|
||||
|
||||
<object id="NHTestObjectDao" type="Spring.Data.NHibernate.NHTestObjectDao, Spring.Data.NHibernate.Integration.Tests">
|
||||
<property name="SessionFactory" ref="SessionFactory"/>
|
||||
</object>
|
||||
-->
|
||||
|
||||
<object id="hibernateTransactionManager"
|
||||
type="Spring.Data.NHibernate.HibernateTransactionManager, Spring.Data.NHibernate3">
|
||||
|
||||
<property name="DbProvider" ref="DbProvider"/>
|
||||
<property name="sessionFactory" ref="SessionFactory"/>
|
||||
|
||||
</object>
|
||||
|
||||
|
||||
|
||||
<!-- Transactional Proxy for TestObjectDao using the TransactionProxyFactory -->
|
||||
<object id="testObjectDaoTransProxy"
|
||||
type="Spring.Transaction.Interceptor.TransactionProxyFactoryObject, Spring.Data">
|
||||
<property name="PlatformTransactionManager" ref="hibernateTransactionManager"/>
|
||||
<property name="Target">
|
||||
<object type="Spring.Data.NHibernate.NHTestObjectDao, Spring.Data.NHibernate3.Integration.Tests">
|
||||
<property name="SessionFactory" ref="SessionFactory"/>
|
||||
</object>
|
||||
</property>
|
||||
|
||||
<property name="ProxyInterfaces" value="Spring.Data.NHibernate.ITestObjectDao"/>
|
||||
|
||||
<property name="TransactionAttributes">
|
||||
<name-values>
|
||||
<add key="Create*" value="PROPAGATION_REQUIRED"/>
|
||||
<add key="Delete*" value="PROPAGATION_REQUIRED"/>
|
||||
<add key="Update*" value="PROPAGATION_REQUIRED"/>
|
||||
<add key="Find*" value="PROPAGATION_REQUIRED"/>
|
||||
</name-values>
|
||||
</property>
|
||||
</object>
|
||||
|
||||
</objects>
|
||||
@@ -1,124 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<objects xmlns='http://www.springframework.net'
|
||||
xmlns:db="http://www.springframework.net/database">
|
||||
|
||||
|
||||
<db:provider id="DbProvider"
|
||||
provider="SqlServer-1.1"
|
||||
connectionString="Data Source=(local);Database=Spring;User ID=springqa;Password=springqa;Trusted_Connection=False"/>
|
||||
<!--
|
||||
connectionString="Data Source=MARKT60\SQL2005;Initial Catalog=Spring;User ID=springqa; Password=springqa"/>
|
||||
-->
|
||||
<!--
|
||||
<db:provider id="DbProvider"
|
||||
provider="OracleODP-2.0"
|
||||
connectionString="Data Source=AGORA; User Id=agora_user; Password=welcome_bad"/>
|
||||
-->
|
||||
<!--
|
||||
<db:provider id="DbProvider"
|
||||
provider="System.Data.SqlClient"
|
||||
connectionString="Data Source=MARKT60\SQL2005;Initial Catalog=Spring;User ID=springqa; Password=springqa"/>
|
||||
-->
|
||||
|
||||
<object id="SessionFactory" type="Spring.Data.NHibernate.LocalSessionFactoryObject, Spring.Data.NHibernate3">
|
||||
<!-- TODO Provide dedicated NHibernate Schema -->
|
||||
<property name="DbProvider" ref="DbProvider"/>
|
||||
<property name="MappingResources">
|
||||
<list>
|
||||
<value>assembly://Spring.Data.NHibernate3.Integration.Tests/Spring.Data.NHibernate/TestObject.hbm.xml</value>
|
||||
</list>
|
||||
</property>
|
||||
<!--
|
||||
<property name="MappingAssemblies">
|
||||
<list>
|
||||
<value>Spring.Data.NHibernate.Integration.Tests</value>
|
||||
</list>
|
||||
</property>
|
||||
-->
|
||||
<property name="HibernateProperties">
|
||||
<dictionary>
|
||||
|
||||
<!--
|
||||
<entry key="hibernate.connection.provider"
|
||||
value="NHibernate.Connection.DriverConnectionProvider"/>
|
||||
|
||||
<entry key="hibernate.dialect"
|
||||
value="NHibernate.Dialect.Oracle9Dialect"/>
|
||||
-->
|
||||
|
||||
|
||||
<entry key="dialect"
|
||||
value="NHibernate.Dialect.MsSql2000Dialect"/>
|
||||
|
||||
<entry key="connection.driver_class"
|
||||
value="NHibernate.Driver.SqlClientDriver"/>
|
||||
|
||||
<!--
|
||||
<entry key="proxyfactory.factory_class"
|
||||
value="NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu"/>
|
||||
-->
|
||||
|
||||
|
||||
</dictionary>
|
||||
</property>
|
||||
|
||||
</object>
|
||||
|
||||
<object id="nativeNHTestObjectDao" type="Spring.Data.NHibernate.NativeNHTestObjectDao, Spring.Data.NHibernate3.Integration.Tests">
|
||||
<property name="SessionFactory" ref="SessionFactory"/>
|
||||
</object>
|
||||
|
||||
<object id="NHTestObjectDao" type="Spring.Data.NHibernate.NHTestObjectDao, Spring.Data.NHibernate3.Integration.Tests">
|
||||
<property name="SessionFactory" ref="SessionFactory"/>
|
||||
</object>
|
||||
|
||||
<object id="hibernateTransactionManager"
|
||||
type="Spring.Data.NHibernate.HibernateTransactionManager, Spring.Data.NHibernate3">
|
||||
|
||||
<property name="DbProvider" ref="DbProvider"/>
|
||||
<property name="sessionFactory" ref="SessionFactory"/>
|
||||
|
||||
</object>
|
||||
|
||||
<!-- Transactional Proxy for TestObjectDao using transaction attributes -->
|
||||
<object id="testObjectDaoViaTxAttributes"
|
||||
type="Spring.Transaction.Interceptor.TransactionProxyFactoryObject, Spring.Data">
|
||||
|
||||
<property name="PlatformTransactionManager" ref="hibernateTransactionManager"/>
|
||||
<property name="Target">
|
||||
<object type="Spring.Data.NHibernate.NHTestObjectDao">
|
||||
<property name="SessionFactory" ref="SessionFactory"/>
|
||||
</object>
|
||||
</property>
|
||||
|
||||
<property name="ProxyInterfaces" value="Spring.Data.NHibernate.ITestObjectDao"/>
|
||||
|
||||
<property name="TransactionAttributeSource">
|
||||
<object type="Spring.Transaction.Interceptor.AttributesTransactionAttributeSource" />
|
||||
</property>
|
||||
</object>
|
||||
|
||||
<!-- Transactional Proxy for TestObjectDao using the TransactionProxyFactory -->
|
||||
<object id="testObjectDaoTransProxy"
|
||||
type="Spring.Transaction.Interceptor.TransactionProxyFactoryObject, Spring.Data">
|
||||
|
||||
<property name="PlatformTransactionManager" ref="hibernateTransactionManager"/>
|
||||
<property name="Target">
|
||||
<object type="Spring.Data.NHibernate.NHTestObjectDao, Spring.Data.NHibernate3.Integration.Tests">
|
||||
<property name="SessionFactory" ref="SessionFactory"/>
|
||||
</object>
|
||||
</property>
|
||||
|
||||
<property name="ProxyInterfaces" value="Spring.Data.NHibernate.ITestObjectDao"/>
|
||||
|
||||
<property name="TransactionAttributes">
|
||||
<name-values>
|
||||
<add key="Create*" value="PROPAGATION_REQUIRED"/>
|
||||
<add key="Delete*" value="PROPAGATION_REQUIRED"/>
|
||||
<add key="Update*" value="PROPAGATION_REQUIRED"/>
|
||||
<add key="Find*" value="PROPAGATION_REQUIRED"/>
|
||||
</name-values>
|
||||
</property>
|
||||
</object>
|
||||
|
||||
</objects>
|
||||
@@ -1,133 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net452</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Aop\Spring.Aop.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Core\Spring.Core.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Data.NHibernate3\Spring.Data.NHibernate3.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Data\Spring.Data.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="log4net" Version="$(Log4NetVersion)" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftTestSDKVersion)" />
|
||||
<PackageReference Include="NUnit" Version="$(NUnitVersion)" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="$(NUnitTestAdapterVersion)" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Transactions" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\AccountController.cs">
|
||||
<Link>Data\NHibernate\AccountController.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\AccountCreditDao.cs">
|
||||
<Link>Data\NHibernate\AccountCreditDao.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\AccountDebitDao.cs">
|
||||
<Link>Data\NHibernate\AccountDebitDao.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\AccountManager.cs">
|
||||
<Link>Data\NHibernate\AccountManager.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\AuditDao.cs">
|
||||
<Link>Data\NHibernate\AuditDao.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Bytecode\AbstractInjectableUserTypeFixture.cs">
|
||||
<Link>Data\Bytecode\AbstractInjectableUserTypeFixture.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Bytecode\Foo.cs">
|
||||
<Link>Data\Bytecode\Foo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Bytecode\IDelimiter.cs">
|
||||
<Link>Data\Bytecode\IDelimiter.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Bytecode\InjectableStringUserType.cs">
|
||||
<Link>Data\Bytecode\InjectableStringUserType.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Bytecode\InjectableUserTypeFixture.cs">
|
||||
<Link>Data\Bytecode\InjectableUserTypeFixture.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Bytecode\Product.cs">
|
||||
<Link>Data\Bytecode\Product.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Credit.cs">
|
||||
<Link>Data\NHibernate\Credit.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\DbProviderTemplateTests.cs">
|
||||
<Link>Data\NHibernate\DbProviderTemplateTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Debit.cs">
|
||||
<Link>Data\NHibernate\Debit.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\HibernateTxScopeTransactionManagerTests.cs">
|
||||
<Link>Data\NHibernate\HibernateTxScopeTransactionManagerTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\IAccountController.cs">
|
||||
<Link>Data\NHibernate\IAccountController.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\IAccountCreditDao.cs">
|
||||
<Link>Data\NHibernate\IAccountCreditDao.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\IAccountDebitDao.cs">
|
||||
<Link>Data\NHibernate\IAccountDebitDao.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\IAccountManager.cs">
|
||||
<Link>Data\NHibernate\IAccountManager.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\IAuditDao.cs">
|
||||
<Link>Data\NHibernate\IAuditDao.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\ITestObjectDao.cs">
|
||||
<Link>Data\NHibernate\ITestObjectDao.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\MultipleDbTests.cs">
|
||||
<Link>Data\NHibernate\MultipleDbTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\NativeNHTestObjectDao.cs">
|
||||
<Link>Data\NHibernate\NativeNHTestObjectDao.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\NativeNHTests.cs">
|
||||
<Link>Data\NHibernate\NativeNHTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\NHDAOTests.cs">
|
||||
<Link>Data\NHibernate\NHDAOTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\NHTestObjectDao.cs">
|
||||
<Link>Data\NHibernate\NHTestObjectDao.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\SimpleTestDao.cs">
|
||||
<Link>Data\NHibernate\SimpleTestDao.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\TemplateTests.cs">
|
||||
<Link>Data\NHibernate\TemplateTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\TestObject.cs">
|
||||
<Link>Data\NHibernate\TestObject.cs</Link>
|
||||
</Compile>
|
||||
<None Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\creditdebit.sql">
|
||||
<Link>Data\NHibernate\creditdebit.sql</Link>
|
||||
</None>
|
||||
<Content Include="Data\**\*">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\HibernateTxScopeTransactionManagerTests.xml">
|
||||
<Link>Data\NHibernate\HibernateTxScopeTransactionManagerTests.xml</Link>
|
||||
</Content>
|
||||
<Content Include="Data\NHibernate\Bytecode\Foo.Spechbm.xml" />
|
||||
<EmbeddedResource Include="Data\NHibernate\Credit.hbm.xml" />
|
||||
<EmbeddedResource Include="Data\NHibernate\Debit.hbm.xml" />
|
||||
<EmbeddedResource Include="Data\NHibernate\MultipleDbTests.xml" />
|
||||
<EmbeddedResource Include="Data\NHibernate\TestObject.hbm.xml" />
|
||||
<EmbeddedResource Include="Data\NHibernate\NHDAOTests.xml" />
|
||||
<EmbeddedResource Include="Data\NHibernate\dbProviderTemplateTests.xml" />
|
||||
<EmbeddedResource Include="Data\NHibernate\templateTests.xml" />
|
||||
<EmbeddedResource Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Controllers.xml">
|
||||
<Link>Data\NHibernate\Controllers.xml</Link>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Services.xml">
|
||||
<Link>Data\NHibernate\Services.xml</Link>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Data\NHibernate\Dao.xml" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,30 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="common">
|
||||
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
|
||||
</sectionGroup>
|
||||
<sectionGroup name="spring">
|
||||
<section name="parsers" type="Spring.Context.Support.NamespaceParsersSectionHandler, Spring.Core" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
|
||||
<!--
|
||||
<common>
|
||||
<logging>
|
||||
<factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4Net129">
|
||||
<arg key="configType" value="EXTERNAL" />
|
||||
</factoryAdapter>
|
||||
</logging>
|
||||
</common>
|
||||
-->
|
||||
|
||||
<spring>
|
||||
<parsers>
|
||||
<parser type="Spring.Data.Config.DatabaseNamespaceParser, Spring.Data"/>
|
||||
<parser type="Spring.Transaction.Config.TxNamespaceParser, Spring.Data" />
|
||||
<parser type="Spring.Aop.Config.AopNamespaceParser, Spring.Aop" />
|
||||
</parsers>
|
||||
</spring>
|
||||
|
||||
</configuration>
|
||||
@@ -1,4 +0,0 @@
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyTitle("Spring.Data.NHibernate33 Integration Tests")]
|
||||
[assembly: AssemblyDescription("Integration tests for Spring.Data.NHibernate33 assembly")]
|
||||
@@ -1,102 +0,0 @@
|
||||
<?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">
|
||||
|
||||
|
||||
<!-- Database and NHibernate Configuration -->
|
||||
|
||||
<db:provider id="DbProvider"
|
||||
provider="SqlServer-2.0"
|
||||
connectionString="Data Source=(local);Initial Catalog=Spring;Persist Security Info=True;User ID=springqa;Password=springqa;"/>
|
||||
|
||||
|
||||
|
||||
<object id="SessionFactory" type="Spring.Data.NHibernate.LocalSessionFactoryObject, Spring.Data.NHibernate3">
|
||||
<property name="DbProvider" ref="DbProvider"/>
|
||||
<property name="MappingResources">
|
||||
<list>
|
||||
<value>assembly://Spring.Data.NHibernate3.Tests/Spring.Data.NHibernate/TestObject.hbm.xml</value>
|
||||
</list>
|
||||
</property>
|
||||
<property name="HibernateProperties">
|
||||
<dictionary>
|
||||
<entry key="dialect"
|
||||
value="NHibernate.Dialect.MsSql2000Dialect"/>
|
||||
|
||||
<entry key="connection.driver_class"
|
||||
value="NHibernate.Driver.SqlClientDriver"/>
|
||||
|
||||
<!--
|
||||
<entry key="proxyfactory.factory_class"
|
||||
value="NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu"/>
|
||||
-->
|
||||
|
||||
</dictionary>
|
||||
</property>
|
||||
|
||||
</object>
|
||||
|
||||
|
||||
<object id="TestObjectDao" type="Spring.Data.NHibernate.TestObjectDao, Spring.Data.NHibernate3.Tests">
|
||||
<property name="SessionFactory" ref="SessionFactory"/>
|
||||
</object>
|
||||
|
||||
<object id="hibernateTransactionManager" type="Spring.Data.NHibernate.HibernateTransactionManager, Spring.Data.NHibernate3">
|
||||
|
||||
<property name="DbProvider" ref="DbProvider"/>
|
||||
<property name="sessionFactory" ref="SessionFactory"/>
|
||||
|
||||
</object>
|
||||
|
||||
<object name="transactionManager" type="Spring.Transaction.CallCountingTransactionManager, Spring.Data.Tests"/>
|
||||
|
||||
<object name="SimpleService" type="Spring.Data.NHibernate.SimpleService, Spring.Data.NHibernate3.Tests">
|
||||
<property name="TestObjectDao" ref="TestObjectDao"/>
|
||||
</object>
|
||||
|
||||
<object id="loggingAroundAdvice" type="Spring.Data.LoggingAroundAdvice, Spring.Data.Tests"/>
|
||||
|
||||
<object id ="myAutoProxy" type="Spring.Aop.Framework.AutoProxy.ObjectNameAutoProxyCreator">
|
||||
|
||||
<property name="InterceptorNames">
|
||||
<list>
|
||||
<value>loggingAroundAdvice</value>
|
||||
</list>
|
||||
</property>
|
||||
|
||||
<property name="ProxyTargetType" value="false"/>
|
||||
<property name="ExposeProxy" value="false"/>
|
||||
<property name="Optimize" value="false"/>
|
||||
|
||||
<property name="ObjectNames">
|
||||
<list>
|
||||
<value>TestObjectDao</value>
|
||||
</list>
|
||||
</property>
|
||||
</object>
|
||||
|
||||
<tx:attribute-driven transaction-manager="transactionManager"/>
|
||||
|
||||
<!-- Transactional Proxy for TestObjectDao using the TransactionProxyFactory -->
|
||||
<!--
|
||||
<object id="testObjectDaoTransProxy"
|
||||
type="Spring.Transaction.Interceptor.TransactionProxyFactoryObject, Spring.Data">
|
||||
|
||||
<property name="PlatformTransactionManager" ref="transactionManager"/>
|
||||
<property name="Target" ref="SimpleService"/>
|
||||
|
||||
<property name="ProxyInterfaces" value="Spring.Data.NHibernate.ISimpleService"/>
|
||||
|
||||
<property name="TransactionAttributes">
|
||||
<name-values>
|
||||
<add key="Create*" value="PROPAGATION_REQUIRED"/>
|
||||
<add key="Delete*" value="PROPAGATION_REQUIRED"/>
|
||||
<add key="Update*" value="PROPAGATION_REQUIRED"/>
|
||||
<add key="Find*" value="PROPAGATION_REQUIRED"/>
|
||||
</name-values>
|
||||
</property>
|
||||
</object>
|
||||
-->
|
||||
|
||||
</objects>
|
||||
@@ -1,100 +0,0 @@
|
||||
<?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"
|
||||
xmlns:aop="http://www.springframework.net/aop">
|
||||
|
||||
|
||||
<!-- Database and NHibernate Configuration -->
|
||||
|
||||
<db:provider id="DbProvider"
|
||||
provider="SqlServer-2.0"
|
||||
connectionString="Data Source=(local);Initial Catalog=Spring;Persist Security Info=True;User ID=springqa;Password=springqa;"/>
|
||||
|
||||
|
||||
|
||||
<object id="SessionFactory" type="Spring.Data.NHibernate.LocalSessionFactoryObject, Spring.Data.NHibernate3">
|
||||
<property name="DbProvider" ref="DbProvider"/>
|
||||
<property name="MappingResources">
|
||||
<list>
|
||||
<value>assembly://Spring.Data.NHibernate3.Tests/Spring.Data.NHibernate/TestObject.hbm.xml</value>
|
||||
</list>
|
||||
</property>
|
||||
<property name="HibernateProperties">
|
||||
<dictionary>
|
||||
<entry key="hibernate.dialect"
|
||||
value="NHibernate.Dialect.MsSql2000Dialect"/>
|
||||
|
||||
<entry key="hibernate.connection.driver_class"
|
||||
value="NHibernate.Driver.SqlClientDriver"/>
|
||||
|
||||
<!--
|
||||
<entry key="proxyfactory.factory_class"
|
||||
value="NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu"/>
|
||||
-->
|
||||
|
||||
|
||||
</dictionary>
|
||||
</property>
|
||||
|
||||
</object>
|
||||
|
||||
|
||||
<object id="TestObjectDao" type="Spring.Data.NHibernate.TestObjectDao, Spring.Data.NHibernate3.Tests">
|
||||
<property name="SessionFactory" ref="SessionFactory"/>
|
||||
</object>
|
||||
|
||||
<object id="transactionManager" type="Spring.Data.NHibernate.HibernateTransactionManager, Spring.Data.NHibernate3">
|
||||
|
||||
<property name="DbProvider" ref="DbProvider"/>
|
||||
<property name="sessionFactory" ref="SessionFactory"/>
|
||||
|
||||
</object>
|
||||
|
||||
|
||||
<object name="SimpleService" type="Spring.Data.NHibernate.SimpleService, Spring.Data.NHibernate3.Tests">
|
||||
<property name="TestObjectDao" ref="TestObjectDao"/>
|
||||
</object>
|
||||
|
||||
<object name="hibernateTemplate" type="Spring.Data.NHibernate.HibernateTemplate, Spring.Data.NHibernate3">
|
||||
<property name="sessionFactory" ref="SessionFactory"/>
|
||||
</object>
|
||||
|
||||
<!-- once add 'internal' role for autoproxycreator that is created via the tx:attribute-driven element -->
|
||||
<!-- then we can add advisors to the config and have them picked up by any 'user' role defined autoproxycreators -->
|
||||
|
||||
<object id="loggingAdvisor" type="Spring.Aop.Support.NameMatchMethodPointcutAdvisor, Spring.Aop">
|
||||
<property name="Advice">
|
||||
<object id="loggingAroundAdvice" type="Spring.Data.LoggingAroundAdvice, Spring.Data.Tests"/>
|
||||
</property>
|
||||
<property name="MappedNames">
|
||||
<list>
|
||||
<value>12341234asdf*</value>
|
||||
</list>
|
||||
</property>
|
||||
</object>
|
||||
|
||||
<object id ="myAutoProxy" type="Spring.Aop.Framework.AutoProxy.ObjectNameAutoProxyCreator">
|
||||
|
||||
<property name="InterceptorNames">
|
||||
<list>
|
||||
<value>loggingAdvisor</value>
|
||||
</list>
|
||||
</property>
|
||||
|
||||
<property name="ProxyTargetType" value="false"/>
|
||||
<property name="ExposeProxy" value="false"/>
|
||||
<property name="Optimize" value="false"/>
|
||||
|
||||
<property name="ObjectNames">
|
||||
<list>
|
||||
<value>TestObjectDao</value>
|
||||
</list>
|
||||
</property>
|
||||
</object>
|
||||
|
||||
|
||||
<tx:attribute-driven transaction-manager="transactionManager"/>
|
||||
|
||||
|
||||
</objects>
|
||||
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
|
||||
<class name="Spring.Data.NHibernate.TestObject, Spring.Data.NHibernate3.Tests" table="TestObjects">
|
||||
<id name="ObjectNumber" column="TestObjectNo" type="Int32">
|
||||
<generator class="identity" />
|
||||
|
||||
<!--
|
||||
<generator class="sequence">
|
||||
<param name="sequence">ID_SEQ</param>
|
||||
</generator>
|
||||
-->
|
||||
|
||||
</id>
|
||||
<property name="Age" column="Age" type="Int32"/>
|
||||
<property name="Name" type="String" length="50"/>
|
||||
</class>
|
||||
</hibernate-mapping>
|
||||
@@ -1,60 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net452</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Aop\Spring.Aop.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Core\Spring.Core.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Data.NHibernate3\Spring.Data.NHibernate3.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Data\Spring.Data.csproj" />
|
||||
<ProjectReference Include="..\Spring.Data.Tests\Spring.Data.Tests.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="FakeItEasy" Version="$(FakeItEasyVersion)" />
|
||||
<PackageReference Include="FakeItEasy.Analyzer" Version="$(FakeItEasyVersion)" PrivateAssets="All" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftTestSDKVersion)" />
|
||||
<PackageReference Include="NUnit" Version="$(NUnitVersion)" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="$(NUnitTestAdapterVersion)" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Tests\Data\NHibernate\Config\AopConfiguration.cs">
|
||||
<Link>Data\NHibernate\Config\AopConfiguration.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Tests\Data\NHibernate\HibernateTransactionManagerTests.cs">
|
||||
<Link>Data\NHibernate\HibernateTransactionManagerTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Tests\Data\NHibernate\ISimpleService.cs">
|
||||
<Link>Data\NHibernate\ISimpleService.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Tests\Data\NHibernate\ITestObjectDao.cs">
|
||||
<Link>Data\NHibernate\ITestObjectDao.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Tests\Data\NHibernate\LocalSessionFactoryObjectTests.cs">
|
||||
<Link>Data\NHibernate\LocalSessionFactoryObjectTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Tests\Data\NHibernate\NHTestObjectDao.cs">
|
||||
<Link>Data\NHibernate\NHTestObjectDao.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Tests\Data\NHibernate\SimpleService.cs">
|
||||
<Link>Data\NHibernate\SimpleService.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Tests\Data\NHibernate\Support\ConfigSectionSessionScopeSettingsTests.cs">
|
||||
<Link>Data\NHibernate\Support\ConfigSectionSessionScopeSettingsTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Tests\Data\NHibernate\Support\SessionScopeSettingsTests.cs">
|
||||
<Link>Data\NHibernate\Support\SessionScopeSettingsTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Tests\Data\NHibernate\Support\SessionScopeTests.cs">
|
||||
<Link>Data\NHibernate\Support\SessionScopeTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Tests\Data\NHibernate\TestObject.cs">
|
||||
<Link>Data\NHibernate\TestObject.cs</Link>
|
||||
</Compile>
|
||||
<Content Include="Data\**\*">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<EmbeddedResource Include="Data\NHibernate\Config\AopConfiguration.xml" />
|
||||
<EmbeddedResource Include="Data\NHibernate\Config\AopConfigurationTxPointcut.xml" />
|
||||
<EmbeddedResource Include="Data\NHibernate\TestObject.hbm.xml" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,39 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="common">
|
||||
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
|
||||
</sectionGroup>
|
||||
<sectionGroup name="spring">
|
||||
<section name="parsers" type="Spring.Context.Support.NamespaceParsersSectionHandler, Spring.Core" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
|
||||
|
||||
<common>
|
||||
<logging>
|
||||
|
||||
<factoryAdapter type="Common.Logging.Simple.ConsoleOutLoggerFactoryAdapter, Common.Logging">
|
||||
<arg key="level" value="WARN" />
|
||||
</factoryAdapter>
|
||||
|
||||
</logging>
|
||||
</common>
|
||||
|
||||
<!--
|
||||
<common>
|
||||
<logging>
|
||||
<factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4Net129">
|
||||
<arg key="configType" value="EXTERNAL" />
|
||||
</factoryAdapter>
|
||||
</logging>
|
||||
</common>
|
||||
-->
|
||||
|
||||
<spring>
|
||||
<parsers>
|
||||
<parser type="Spring.Data.Config.DatabaseNamespaceParser, Spring.Data" />
|
||||
</parsers>
|
||||
</spring>
|
||||
|
||||
</configuration>
|
||||
@@ -1,4 +0,0 @@
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyTitle("Spring.Data.NHibernate4 Integration Tests")]
|
||||
[assembly: AssemblyDescription("Integration tests for Spring.Data.NHibernate4 assembly")]
|
||||
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
|
||||
assembly="uNhAddIns.Adapters.CommonTests"
|
||||
namespace="uNhAddIns.Adapters.CommonTests.EnhancedBytecodeProvider">
|
||||
|
||||
<typedef name="SpecialString"
|
||||
class="InjectableStringUserType"/>
|
||||
|
||||
<class name ="Foo">
|
||||
<id type="int">
|
||||
<generator class="hilo"/>
|
||||
</id>
|
||||
<property name="Description" type="SpecialString" />
|
||||
</class>
|
||||
</hibernate-mapping>
|
||||
@@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
|
||||
<class name="Spring.Data.NHibernate.Credit, Spring.Data.NHibernate4.Integration.Tests"
|
||||
table="Credits" lazy="false">
|
||||
<id name="CreditID" column="CreditID" type="Int32">
|
||||
<generator class="identity" />
|
||||
</id>
|
||||
<property name="Amount" column="CreditAmount"/>
|
||||
</class>
|
||||
</hibernate-mapping>
|
||||
@@ -1,63 +0,0 @@
|
||||
<?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.NHibernate4">
|
||||
<!-- 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.NHibernate4">
|
||||
<property name="DbProvider" ref="DbProvider"/>
|
||||
|
||||
|
||||
<property name="MappingAssemblies">
|
||||
<list>
|
||||
<value>Spring.Data.NHibernate4.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">
|
||||
<property name="SessionFactory" ref="SessionFactory"/>
|
||||
</object>
|
||||
<object id="AccountDebitDao" type="Spring.Data.NHibernate.AccountDebitDao">
|
||||
<property name="SessionFactory" ref="SessionFactory"/>
|
||||
</object>
|
||||
|
||||
<object id="AuditDao" type="Spring.Data.NHibernate.AuditDao">
|
||||
<property name="DbProvider" ref="DbProvider"/>
|
||||
</object>
|
||||
|
||||
</objects>
|
||||
@@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
|
||||
<class name="Spring.Data.NHibernate.Debit, Spring.Data.NHibernate4.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>
|
||||
@@ -1,129 +0,0 @@
|
||||
<?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.NHibernate4">
|
||||
|
||||
<property name="DbProvider" ref="DbProvider1"/>
|
||||
<property name="MappingAssemblies">
|
||||
<list>
|
||||
<value>Spring.Data.NHibernate4.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.NHibernate4">
|
||||
|
||||
<property name="DbProvider" ref="DbProvider2"/>
|
||||
<property name="MappingAssemblies">
|
||||
<list>
|
||||
<value>Spring.Data.NHibernate4.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.NHibernate4.Integration.Tests">
|
||||
<property name="SessionFactory" ref="SessionFactory1"/>
|
||||
</object>
|
||||
<object id="AccountDebitDao" type="Spring.Data.NHibernate.AccountDebitDao, Spring.Data.NHibernate4.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.NHibernate4.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>
|
||||
@@ -1,122 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<objects xmlns='http://www.springframework.net'
|
||||
xmlns:db="http://www.springframework.net/database">
|
||||
|
||||
<db:provider id="DbProvider"
|
||||
provider="SqlServer-1.1"
|
||||
connectionString="Data Source=(local);Database=Spring;User ID=springqa;Password=springqa;Trusted_Connection=False"/>
|
||||
|
||||
<!--
|
||||
<db:provider id="DbProvider"
|
||||
provider="System.Data.SqlClient"
|
||||
connectionString="Data Source=MARKT60\SQL2005;Initial Catalog=CreditsAndDebits;User ID=springqa;Password=springqa"/>
|
||||
-->
|
||||
|
||||
<object id="SessionFactory" type="Spring.Data.NHibernate.LocalSessionFactoryObject, Spring.Data.NHibernate4">
|
||||
<property name="DbProvider" ref="DbProvider"/>
|
||||
|
||||
|
||||
<property name="MappingAssemblies">
|
||||
<list>
|
||||
<value>Spring.Data.NHibernate4.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"/>
|
||||
|
||||
<!--
|
||||
<entry key="proxyfactory.factory_class"
|
||||
value="NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu"/>
|
||||
-->
|
||||
|
||||
|
||||
</dictionary>
|
||||
</property>
|
||||
|
||||
</object>
|
||||
|
||||
<object id="AccountCreditDao" type="Spring.Data.NHibernate.AccountCreditDao, Spring.Data.NHibernate4.Integration.Tests">
|
||||
<property name="SessionFactory" ref="SessionFactory"/>
|
||||
</object>
|
||||
<object id="AccountDebitDao" type="Spring.Data.NHibernate.AccountDebitDao, Spring.Data.NHibernate4.Integration.Tests">
|
||||
<property name="SessionFactory" ref="SessionFactory"/>
|
||||
</object>
|
||||
|
||||
<object id="AuditDao" type="Spring.Data.NHibernate.AuditDao, Spring.Data.NHibernate4.Integration.Tests">
|
||||
<property name="DbProvider" ref="DbProvider"/>
|
||||
</object>
|
||||
|
||||
|
||||
<!-- The DAO object that performs multiple data access operations -->
|
||||
<object id="accountManagerTarget"
|
||||
type="Spring.Data.NHibernate.AccountManager, Spring.Data.NHibernate4.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>
|
||||
|
||||
<object id="hibernateTransactionManager"
|
||||
type="Spring.Data.NHibernate.HibernateTransactionManager, Spring.Data.NHibernate4">
|
||||
<!-- 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>
|
||||
|
||||
<!-- 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="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>
|
||||
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
|
||||
<class name="Spring.Data.NHibernate.TestObject, Spring.Data.NHibernate4.Integration.Tests" table="TestObjects">
|
||||
<id name="ObjectNumber" column="TestObjectNo" type="Int32">
|
||||
<generator class="identity" />
|
||||
|
||||
<!--
|
||||
<generator class="sequence">
|
||||
<param name="sequence">ID_SEQ</param>
|
||||
</generator>
|
||||
-->
|
||||
|
||||
</id>
|
||||
<property name="Age" column="Age" type="Int32"/>
|
||||
<property name="Name" type="String" length="50"/>
|
||||
</class>
|
||||
</hibernate-mapping>
|
||||
@@ -1,110 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<objects xmlns='http://www.springframework.net'
|
||||
xmlns:db="http://www.springframework.net/database">
|
||||
|
||||
<!--
|
||||
<db:provider id="DbProvider"
|
||||
provider="SqlServer-1.1"
|
||||
connectionString="Data Source=MARKT60\SQL2005;Database=Spring;User ID=springqa;Password=springqa;Trusted_Connection=False"/>
|
||||
-->
|
||||
|
||||
<object id="DbProvider" type="Spring.Data.Common.UserCredentialsDbProvider, Spring.Data">
|
||||
<property name="TargetDbProvider" ref="targetDbProvider"/>
|
||||
<property name="Username" value="User ID=springqa"/>
|
||||
<property name="Password" value="Password=springqa"/>
|
||||
</object>
|
||||
|
||||
<db:provider id="targetDbProvider"
|
||||
provider="SqlServer-2.0"
|
||||
connectionString="Data Source=(local);Database=Spring;Trusted_Connection=False"/>
|
||||
|
||||
|
||||
<db:provider id="standardDbProvider"
|
||||
provider="SqlServer-2.0"
|
||||
connectionString="Data Source=(local);Database=Spring;Trusted_Connection=False;User ID=springqa;Password=springqa"/>
|
||||
|
||||
|
||||
|
||||
<object id="SessionFactory" type="Spring.Data.NHibernate.LocalSessionFactoryObject, Spring.Data.NHibernate4">
|
||||
<property name="DbProvider" ref="DbProvider"/>
|
||||
<property name="MappingResources">
|
||||
<list>
|
||||
<value>assembly://Spring.Data.NHibernate4.Integration.Tests/Spring.Data.NHibernate/TestObject.hbm.xml</value>
|
||||
</list>
|
||||
</property>
|
||||
<!--
|
||||
<property name="MappingAssemblies">
|
||||
<list>
|
||||
<value>Spring.Data.NHibernate.Integration.Tests</value>
|
||||
</list>
|
||||
</property>
|
||||
-->
|
||||
<property name="HibernateProperties">
|
||||
<dictionary>
|
||||
<!-- use connection provided by DbProvider
|
||||
<entry key="hibernate.connection.provider"
|
||||
value="NHibernate.Connection.DriverConnectionProvider"/>
|
||||
-->
|
||||
<entry key="dialect"
|
||||
value="NHibernate.Dialect.MsSql2000Dialect"/>
|
||||
|
||||
<entry key="connection.driver_class"
|
||||
value="NHibernate.Driver.SqlClientDriver"/>
|
||||
|
||||
<!--
|
||||
<entry key="hibernate.dialect"
|
||||
value="NHibernate.Dialect.Oracle9Dialect"/>
|
||||
-->
|
||||
|
||||
<!--
|
||||
<entry key="proxyfactory.factory_class"
|
||||
value="NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu"/>
|
||||
-->
|
||||
</dictionary>
|
||||
</property>
|
||||
|
||||
</object>
|
||||
|
||||
<!--
|
||||
<object id="nativeNHTestObjectDao" type="Spring.Data.NHibernate.NativeNHTestObjectDao, Spring.Data.NHibernate.Integration.Tests">
|
||||
<property name="SessionFactory" ref="SessionFactory"/>
|
||||
</object>
|
||||
|
||||
<object id="NHTestObjectDao" type="Spring.Data.NHibernate.NHTestObjectDao, Spring.Data.NHibernate.Integration.Tests">
|
||||
<property name="SessionFactory" ref="SessionFactory"/>
|
||||
</object>
|
||||
-->
|
||||
|
||||
<object id="hibernateTransactionManager"
|
||||
type="Spring.Data.NHibernate.HibernateTransactionManager, Spring.Data.NHibernate4">
|
||||
|
||||
<property name="DbProvider" ref="DbProvider"/>
|
||||
<property name="sessionFactory" ref="SessionFactory"/>
|
||||
|
||||
</object>
|
||||
|
||||
|
||||
|
||||
<!-- Transactional Proxy for TestObjectDao using the TransactionProxyFactory -->
|
||||
<object id="testObjectDaoTransProxy"
|
||||
type="Spring.Transaction.Interceptor.TransactionProxyFactoryObject, Spring.Data">
|
||||
<property name="PlatformTransactionManager" ref="hibernateTransactionManager"/>
|
||||
<property name="Target">
|
||||
<object type="Spring.Data.NHibernate.NHTestObjectDao, Spring.Data.NHibernate4.Integration.Tests">
|
||||
<property name="SessionFactory" ref="SessionFactory"/>
|
||||
</object>
|
||||
</property>
|
||||
|
||||
<property name="ProxyInterfaces" value="Spring.Data.NHibernate.ITestObjectDao"/>
|
||||
|
||||
<property name="TransactionAttributes">
|
||||
<name-values>
|
||||
<add key="Create*" value="PROPAGATION_REQUIRED"/>
|
||||
<add key="Delete*" value="PROPAGATION_REQUIRED"/>
|
||||
<add key="Update*" value="PROPAGATION_REQUIRED"/>
|
||||
<add key="Find*" value="PROPAGATION_REQUIRED"/>
|
||||
</name-values>
|
||||
</property>
|
||||
</object>
|
||||
|
||||
</objects>
|
||||
@@ -1,124 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<objects xmlns='http://www.springframework.net'
|
||||
xmlns:db="http://www.springframework.net/database">
|
||||
|
||||
|
||||
<db:provider id="DbProvider"
|
||||
provider="SqlServer-1.1"
|
||||
connectionString="Data Source=(local);Database=Spring;User ID=springqa;Password=springqa;Trusted_Connection=False"/>
|
||||
<!--
|
||||
connectionString="Data Source=MARKT60\SQL2005;Initial Catalog=Spring;User ID=springqa; Password=springqa"/>
|
||||
-->
|
||||
<!--
|
||||
<db:provider id="DbProvider"
|
||||
provider="OracleODP-2.0"
|
||||
connectionString="Data Source=AGORA; User Id=agora_user; Password=welcome_bad"/>
|
||||
-->
|
||||
<!--
|
||||
<db:provider id="DbProvider"
|
||||
provider="System.Data.SqlClient"
|
||||
connectionString="Data Source=MARKT60\SQL2005;Initial Catalog=Spring;User ID=springqa; Password=springqa"/>
|
||||
-->
|
||||
|
||||
<object id="SessionFactory" type="Spring.Data.NHibernate.LocalSessionFactoryObject, Spring.Data.NHibernate4">
|
||||
<!-- TODO Provide dedicated NHibernate Schema -->
|
||||
<property name="DbProvider" ref="DbProvider"/>
|
||||
<property name="MappingResources">
|
||||
<list>
|
||||
<value>assembly://Spring.Data.NHibernate4.Integration.Tests/Spring.Data.NHibernate/TestObject.hbm.xml</value>
|
||||
</list>
|
||||
</property>
|
||||
<!--
|
||||
<property name="MappingAssemblies">
|
||||
<list>
|
||||
<value>Spring.Data.NHibernate.Integration.Tests</value>
|
||||
</list>
|
||||
</property>
|
||||
-->
|
||||
<property name="HibernateProperties">
|
||||
<dictionary>
|
||||
|
||||
<!--
|
||||
<entry key="hibernate.connection.provider"
|
||||
value="NHibernate.Connection.DriverConnectionProvider"/>
|
||||
|
||||
<entry key="hibernate.dialect"
|
||||
value="NHibernate.Dialect.Oracle9Dialect"/>
|
||||
-->
|
||||
|
||||
|
||||
<entry key="dialect"
|
||||
value="NHibernate.Dialect.MsSql2000Dialect"/>
|
||||
|
||||
<entry key="connection.driver_class"
|
||||
value="NHibernate.Driver.SqlClientDriver"/>
|
||||
|
||||
<!--
|
||||
<entry key="proxyfactory.factory_class"
|
||||
value="NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu"/>
|
||||
-->
|
||||
|
||||
|
||||
</dictionary>
|
||||
</property>
|
||||
|
||||
</object>
|
||||
|
||||
<object id="nativeNHTestObjectDao" type="Spring.Data.NHibernate.NativeNHTestObjectDao, Spring.Data.NHibernate4.Integration.Tests">
|
||||
<property name="SessionFactory" ref="SessionFactory"/>
|
||||
</object>
|
||||
|
||||
<object id="NHTestObjectDao" type="Spring.Data.NHibernate.NHTestObjectDao, Spring.Data.NHibernate4.Integration.Tests">
|
||||
<property name="SessionFactory" ref="SessionFactory"/>
|
||||
</object>
|
||||
|
||||
<object id="hibernateTransactionManager"
|
||||
type="Spring.Data.NHibernate.HibernateTransactionManager, Spring.Data.NHibernate4">
|
||||
|
||||
<property name="DbProvider" ref="DbProvider"/>
|
||||
<property name="sessionFactory" ref="SessionFactory"/>
|
||||
|
||||
</object>
|
||||
|
||||
<!-- Transactional Proxy for TestObjectDao using transaction attributes -->
|
||||
<object id="testObjectDaoViaTxAttributes"
|
||||
type="Spring.Transaction.Interceptor.TransactionProxyFactoryObject, Spring.Data">
|
||||
|
||||
<property name="PlatformTransactionManager" ref="hibernateTransactionManager"/>
|
||||
<property name="Target">
|
||||
<object type="Spring.Data.NHibernate.NHTestObjectDao">
|
||||
<property name="SessionFactory" ref="SessionFactory"/>
|
||||
</object>
|
||||
</property>
|
||||
|
||||
<property name="ProxyInterfaces" value="Spring.Data.NHibernate.ITestObjectDao"/>
|
||||
|
||||
<property name="TransactionAttributeSource">
|
||||
<object type="Spring.Transaction.Interceptor.AttributesTransactionAttributeSource" />
|
||||
</property>
|
||||
</object>
|
||||
|
||||
<!-- Transactional Proxy for TestObjectDao using the TransactionProxyFactory -->
|
||||
<object id="testObjectDaoTransProxy"
|
||||
type="Spring.Transaction.Interceptor.TransactionProxyFactoryObject, Spring.Data">
|
||||
|
||||
<property name="PlatformTransactionManager" ref="hibernateTransactionManager"/>
|
||||
<property name="Target">
|
||||
<object type="Spring.Data.NHibernate.NHTestObjectDao, Spring.Data.NHibernate4.Integration.Tests">
|
||||
<property name="SessionFactory" ref="SessionFactory"/>
|
||||
</object>
|
||||
</property>
|
||||
|
||||
<property name="ProxyInterfaces" value="Spring.Data.NHibernate.ITestObjectDao"/>
|
||||
|
||||
<property name="TransactionAttributes">
|
||||
<name-values>
|
||||
<add key="Create*" value="PROPAGATION_REQUIRED"/>
|
||||
<add key="Delete*" value="PROPAGATION_REQUIRED"/>
|
||||
<add key="Update*" value="PROPAGATION_REQUIRED"/>
|
||||
<add key="Find*" value="PROPAGATION_REQUIRED"/>
|
||||
</name-values>
|
||||
</property>
|
||||
</object>
|
||||
|
||||
</objects>
|
||||
@@ -1,126 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net452</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Aop\Spring.Aop.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Core\Spring.Core.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Data.NHibernate4\Spring.Data.NHibernate4.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Data\Spring.Data.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="log4net" Version="$(Log4NetVersion)" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftTestSDKVersion)" />
|
||||
<PackageReference Include="NUnit" Version="$(NUnitVersion)" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="$(NUnitTestAdapterVersion)" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Transactions" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\AccountController.cs">
|
||||
<Link>Data\NHibernate\AccountController.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\AccountCreditDao.cs">
|
||||
<Link>Data\NHibernate\AccountCreditDao.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\AccountDebitDao.cs">
|
||||
<Link>Data\NHibernate\AccountDebitDao.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\AccountManager.cs">
|
||||
<Link>Data\NHibernate\AccountManager.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\AuditDao.cs">
|
||||
<Link>Data\NHibernate\AuditDao.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Bytecode\AbstractInjectableUserTypeFixture.cs">
|
||||
<Link>Data\Bytecode\AbstractInjectableUserTypeFixture.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Bytecode\Foo.cs">
|
||||
<Link>Data\Bytecode\Foo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Bytecode\IDelimiter.cs">
|
||||
<Link>Data\Bytecode\IDelimiter.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Bytecode\InjectableStringUserType.cs">
|
||||
<Link>Data\Bytecode\InjectableStringUserType.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Bytecode\InjectableUserTypeFixture.cs">
|
||||
<Link>Data\Bytecode\InjectableUserTypeFixture.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Bytecode\Product.cs">
|
||||
<Link>Data\Bytecode\Product.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Credit.cs">
|
||||
<Link>Data\NHibernate\Credit.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\DbProviderTemplateTests.cs">
|
||||
<Link>Data\NHibernate\DbProviderTemplateTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Debit.cs">
|
||||
<Link>Data\NHibernate\Debit.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\HibernateTxScopeTransactionManagerTests.cs">
|
||||
<Link>Data\NHibernate\HibernateTxScopeTransactionManagerTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\IAccountController.cs">
|
||||
<Link>Data\NHibernate\IAccountController.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\IAccountCreditDao.cs">
|
||||
<Link>Data\NHibernate\IAccountCreditDao.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\IAccountDebitDao.cs">
|
||||
<Link>Data\NHibernate\IAccountDebitDao.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\IAccountManager.cs">
|
||||
<Link>Data\NHibernate\IAccountManager.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\IAuditDao.cs">
|
||||
<Link>Data\NHibernate\IAuditDao.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\ITestObjectDao.cs">
|
||||
<Link>Data\NHibernate\ITestObjectDao.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\MultipleDbTests.cs">
|
||||
<Link>Data\NHibernate\MultipleDbTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\NativeNHTestObjectDao.cs">
|
||||
<Link>Data\NHibernate\NativeNHTestObjectDao.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\NativeNHTests.cs">
|
||||
<Link>Data\NHibernate\NativeNHTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\NHDAOTests.cs">
|
||||
<Link>Data\NHibernate\NHDAOTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\NHTestObjectDao.cs">
|
||||
<Link>Data\NHibernate\NHTestObjectDao.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\SimpleTestDao.cs">
|
||||
<Link>Data\NHibernate\SimpleTestDao.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\TemplateTests.cs">
|
||||
<Link>Data\NHibernate\TemplateTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\TestObject.cs">
|
||||
<Link>Data\NHibernate\TestObject.cs</Link>
|
||||
</Compile>
|
||||
<None Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\creditdebit.sql">
|
||||
<Link>Data\NHibernate\creditdebit.sql</Link>
|
||||
</None>
|
||||
<Content Include="Data\**\*">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\HibernateTxScopeTransactionManagerTests.xml">
|
||||
<Link>Data\NHibernate\HibernateTxScopeTransactionManagerTests.xml</Link>
|
||||
</Content>
|
||||
<Content Include="Data\NHibernate\Bytecode\Foo.Spechbm.xml" />
|
||||
<EmbeddedResource Include="Data\NHibernate\*.xml" />
|
||||
<EmbeddedResource Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Controllers.xml">
|
||||
<Link>Data\NHibernate\Controllers.xml</Link>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Services.xml">
|
||||
<Link>Data\NHibernate\Services.xml</Link>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,30 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="common">
|
||||
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
|
||||
</sectionGroup>
|
||||
<sectionGroup name="spring">
|
||||
<section name="parsers" type="Spring.Context.Support.NamespaceParsersSectionHandler, Spring.Core" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
|
||||
<!--
|
||||
<common>
|
||||
<logging>
|
||||
<factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4Net129">
|
||||
<arg key="configType" value="EXTERNAL" />
|
||||
</factoryAdapter>
|
||||
</logging>
|
||||
</common>
|
||||
-->
|
||||
|
||||
<spring>
|
||||
<parsers>
|
||||
<parser type="Spring.Data.Config.DatabaseNamespaceParser, Spring.Data"/>
|
||||
<parser type="Spring.Transaction.Config.TxNamespaceParser, Spring.Data" />
|
||||
<parser type="Spring.Aop.Config.AopNamespaceParser, Spring.Aop" />
|
||||
</parsers>
|
||||
</spring>
|
||||
|
||||
</configuration>
|
||||
@@ -1,4 +0,0 @@
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyTitle("Spring.Data.NHibernate4 Integration Tests")]
|
||||
[assembly: AssemblyDescription("Integration tests for Spring.Data.NHibernate4 assembly")]
|
||||
@@ -1,102 +0,0 @@
|
||||
<?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">
|
||||
|
||||
|
||||
<!-- Database and NHibernate Configuration -->
|
||||
|
||||
<db:provider id="DbProvider"
|
||||
provider="SqlServer-2.0"
|
||||
connectionString="Data Source=(local);Initial Catalog=Spring;Persist Security Info=True;User ID=springqa;Password=springqa;"/>
|
||||
|
||||
|
||||
|
||||
<object id="SessionFactory" type="Spring.Data.NHibernate.LocalSessionFactoryObject, Spring.Data.NHibernate4">
|
||||
<property name="DbProvider" ref="DbProvider"/>
|
||||
<property name="MappingResources">
|
||||
<list>
|
||||
<value>assembly://Spring.Data.NHibernate4.Tests/Spring.Data.NHibernate/TestObject.hbm.xml</value>
|
||||
</list>
|
||||
</property>
|
||||
<property name="HibernateProperties">
|
||||
<dictionary>
|
||||
<entry key="dialect"
|
||||
value="NHibernate.Dialect.MsSql2000Dialect"/>
|
||||
|
||||
<entry key="connection.driver_class"
|
||||
value="NHibernate.Driver.SqlClientDriver"/>
|
||||
|
||||
<!--
|
||||
<entry key="proxyfactory.factory_class"
|
||||
value="NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu"/>
|
||||
-->
|
||||
|
||||
</dictionary>
|
||||
</property>
|
||||
|
||||
</object>
|
||||
|
||||
|
||||
<object id="TestObjectDao" type="Spring.Data.NHibernate.TestObjectDao, Spring.Data.NHibernate4.Tests">
|
||||
<property name="SessionFactory" ref="SessionFactory"/>
|
||||
</object>
|
||||
|
||||
<object id="hibernateTransactionManager" type="Spring.Data.NHibernate.HibernateTransactionManager, Spring.Data.NHibernate4">
|
||||
|
||||
<property name="DbProvider" ref="DbProvider"/>
|
||||
<property name="sessionFactory" ref="SessionFactory"/>
|
||||
|
||||
</object>
|
||||
|
||||
<object name="transactionManager" type="Spring.Transaction.CallCountingTransactionManager, Spring.Data.Tests"/>
|
||||
|
||||
<object name="SimpleService" type="Spring.Data.NHibernate.SimpleService, Spring.Data.NHibernate4.Tests">
|
||||
<property name="TestObjectDao" ref="TestObjectDao"/>
|
||||
</object>
|
||||
|
||||
<object id="loggingAroundAdvice" type="Spring.Data.LoggingAroundAdvice, Spring.Data.Tests"/>
|
||||
|
||||
<object id ="myAutoProxy" type="Spring.Aop.Framework.AutoProxy.ObjectNameAutoProxyCreator">
|
||||
|
||||
<property name="InterceptorNames">
|
||||
<list>
|
||||
<value>loggingAroundAdvice</value>
|
||||
</list>
|
||||
</property>
|
||||
|
||||
<property name="ProxyTargetType" value="false"/>
|
||||
<property name="ExposeProxy" value="false"/>
|
||||
<property name="Optimize" value="false"/>
|
||||
|
||||
<property name="ObjectNames">
|
||||
<list>
|
||||
<value>TestObjectDao</value>
|
||||
</list>
|
||||
</property>
|
||||
</object>
|
||||
|
||||
<tx:attribute-driven transaction-manager="transactionManager"/>
|
||||
|
||||
<!-- Transactional Proxy for TestObjectDao using the TransactionProxyFactory -->
|
||||
<!--
|
||||
<object id="testObjectDaoTransProxy"
|
||||
type="Spring.Transaction.Interceptor.TransactionProxyFactoryObject, Spring.Data">
|
||||
|
||||
<property name="PlatformTransactionManager" ref="transactionManager"/>
|
||||
<property name="Target" ref="SimpleService"/>
|
||||
|
||||
<property name="ProxyInterfaces" value="Spring.Data.NHibernate.ISimpleService"/>
|
||||
|
||||
<property name="TransactionAttributes">
|
||||
<name-values>
|
||||
<add key="Create*" value="PROPAGATION_REQUIRED"/>
|
||||
<add key="Delete*" value="PROPAGATION_REQUIRED"/>
|
||||
<add key="Update*" value="PROPAGATION_REQUIRED"/>
|
||||
<add key="Find*" value="PROPAGATION_REQUIRED"/>
|
||||
</name-values>
|
||||
</property>
|
||||
</object>
|
||||
-->
|
||||
|
||||
</objects>
|
||||
@@ -1,100 +0,0 @@
|
||||
<?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"
|
||||
xmlns:aop="http://www.springframework.net/aop">
|
||||
|
||||
|
||||
<!-- Database and NHibernate Configuration -->
|
||||
|
||||
<db:provider id="DbProvider"
|
||||
provider="SqlServer-2.0"
|
||||
connectionString="Data Source=(local);Initial Catalog=Spring;Persist Security Info=True;User ID=springqa;Password=springqa;"/>
|
||||
|
||||
|
||||
|
||||
<object id="SessionFactory" type="Spring.Data.NHibernate.LocalSessionFactoryObject, Spring.Data.NHibernate4">
|
||||
<property name="DbProvider" ref="DbProvider"/>
|
||||
<property name="MappingResources">
|
||||
<list>
|
||||
<value>assembly://Spring.Data.NHibernate4.Tests/Spring.Data.NHibernate/TestObject.hbm.xml</value>
|
||||
</list>
|
||||
</property>
|
||||
<property name="HibernateProperties">
|
||||
<dictionary>
|
||||
<entry key="hibernate.dialect"
|
||||
value="NHibernate.Dialect.MsSql2000Dialect"/>
|
||||
|
||||
<entry key="hibernate.connection.driver_class"
|
||||
value="NHibernate.Driver.SqlClientDriver"/>
|
||||
|
||||
<!--
|
||||
<entry key="proxyfactory.factory_class"
|
||||
value="NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu"/>
|
||||
-->
|
||||
|
||||
|
||||
</dictionary>
|
||||
</property>
|
||||
|
||||
</object>
|
||||
|
||||
|
||||
<object id="TestObjectDao" type="Spring.Data.NHibernate.TestObjectDao, Spring.Data.NHibernate4.Tests">
|
||||
<property name="SessionFactory" ref="SessionFactory"/>
|
||||
</object>
|
||||
|
||||
<object id="transactionManager" type="Spring.Data.NHibernate.HibernateTransactionManager, Spring.Data.NHibernate4">
|
||||
|
||||
<property name="DbProvider" ref="DbProvider"/>
|
||||
<property name="sessionFactory" ref="SessionFactory"/>
|
||||
|
||||
</object>
|
||||
|
||||
|
||||
<object name="SimpleService" type="Spring.Data.NHibernate.SimpleService, Spring.Data.NHibernate4.Tests">
|
||||
<property name="TestObjectDao" ref="TestObjectDao"/>
|
||||
</object>
|
||||
|
||||
<object name="hibernateTemplate" type="Spring.Data.NHibernate.HibernateTemplate, Spring.Data.NHibernate4">
|
||||
<property name="sessionFactory" ref="SessionFactory"/>
|
||||
</object>
|
||||
|
||||
<!-- once add 'internal' role for autoproxycreator that is created via the tx:attribute-driven element -->
|
||||
<!-- then we can add advisors to the config and have them picked up by any 'user' role defined autoproxycreators -->
|
||||
|
||||
<object id="loggingAdvisor" type="Spring.Aop.Support.NameMatchMethodPointcutAdvisor, Spring.Aop">
|
||||
<property name="Advice">
|
||||
<object id="loggingAroundAdvice" type="Spring.Data.LoggingAroundAdvice, Spring.Data.Tests"/>
|
||||
</property>
|
||||
<property name="MappedNames">
|
||||
<list>
|
||||
<value>12341234asdf*</value>
|
||||
</list>
|
||||
</property>
|
||||
</object>
|
||||
|
||||
<object id ="myAutoProxy" type="Spring.Aop.Framework.AutoProxy.ObjectNameAutoProxyCreator">
|
||||
|
||||
<property name="InterceptorNames">
|
||||
<list>
|
||||
<value>loggingAdvisor</value>
|
||||
</list>
|
||||
</property>
|
||||
|
||||
<property name="ProxyTargetType" value="false"/>
|
||||
<property name="ExposeProxy" value="false"/>
|
||||
<property name="Optimize" value="false"/>
|
||||
|
||||
<property name="ObjectNames">
|
||||
<list>
|
||||
<value>TestObjectDao</value>
|
||||
</list>
|
||||
</property>
|
||||
</object>
|
||||
|
||||
|
||||
<tx:attribute-driven transaction-manager="transactionManager"/>
|
||||
|
||||
|
||||
</objects>
|
||||
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
|
||||
<class name="Spring.Data.NHibernate.TestObject, Spring.Data.NHibernate4.Tests" table="TestObjects">
|
||||
<id name="ObjectNumber" column="TestObjectNo" type="Int32">
|
||||
<generator class="identity" />
|
||||
|
||||
<!--
|
||||
<generator class="sequence">
|
||||
<param name="sequence">ID_SEQ</param>
|
||||
</generator>
|
||||
-->
|
||||
|
||||
</id>
|
||||
<property name="Age" column="Age" type="Int32"/>
|
||||
<property name="Name" type="String" length="50"/>
|
||||
</class>
|
||||
</hibernate-mapping>
|
||||
@@ -1,66 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net452</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Aop\Spring.Aop.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Core\Spring.Core.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Data.NHibernate4\Spring.Data.NHibernate4.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Data\Spring.Data.csproj" />
|
||||
<ProjectReference Include="..\Spring.Data.Tests\Spring.Data.Tests.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="FakeItEasy" Version="$(FakeItEasyVersion)" />
|
||||
<PackageReference Include="FakeItEasy.Analyzer" Version="$(FakeItEasyVersion)" PrivateAssets="All" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftTestSDKVersion)" />
|
||||
<PackageReference Include="NUnit" Version="$(NUnitVersion)" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="$(NUnitTestAdapterVersion)" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Tests\Data\NHibernate\Config\AopConfiguration.cs">
|
||||
<Link>Data\NHibernate\Config\AopConfiguration.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Tests\Data\NHibernate\DelegatingLocalSessionFactoryObjectTests.cs">
|
||||
<Link>Data\NHibernate\DelegatingLocalSessionFactoryObjectTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Tests\Data\NHibernate\HibernateTransactionManagerTests.cs">
|
||||
<Link>Data\NHibernate\HibernateTransactionManagerTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Tests\Data\NHibernate\ISimpleService.cs">
|
||||
<Link>Data\NHibernate\ISimpleService.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Tests\Data\NHibernate\ITestObjectDao.cs">
|
||||
<Link>Data\NHibernate\ITestObjectDao.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Tests\Data\NHibernate\LocalSessionFactoryObjectTests.cs">
|
||||
<Link>Data\NHibernate\LocalSessionFactoryObjectTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Tests\Data\NHibernate\NHTestObjectDao.cs">
|
||||
<Link>Data\NHibernate\NHTestObjectDao.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Tests\Data\NHibernate\SessionFactoryUtilsTests.cs">
|
||||
<Link>Data\NHibernate\SessionFactoryUtilsTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Tests\Data\NHibernate\SimpleService.cs">
|
||||
<Link>Data\NHibernate\SimpleService.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Tests\Data\NHibernate\Support\ConfigSectionSessionScopeSettingsTests.cs">
|
||||
<Link>Data\NHibernate\Support\ConfigSectionSessionScopeSettingsTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Tests\Data\NHibernate\Support\SessionScopeSettingsTests.cs">
|
||||
<Link>Data\NHibernate\Support\SessionScopeSettingsTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Tests\Data\NHibernate\Support\SessionScopeTests.cs">
|
||||
<Link>Data\NHibernate\Support\SessionScopeTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Tests\Data\NHibernate\TestObject.cs">
|
||||
<Link>Data\NHibernate\TestObject.cs</Link>
|
||||
</Compile>
|
||||
<Content Include="Data\**\*">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<EmbeddedResource Include="Data\NHibernate\Config\AopConfiguration.xml" />
|
||||
<EmbeddedResource Include="Data\NHibernate\Config\AopConfigurationTxPointcut.xml" />
|
||||
<EmbeddedResource Include="Data\NHibernate\TestObject.hbm.xml" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,14 +1,14 @@
|
||||
using Spring.Data.NHibernate.Support;
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
public class AccountCreditDao : HibernateDaoSupport, IAccountCreditDao
|
||||
{
|
||||
public void CreateCredit(float creditAmount)
|
||||
{
|
||||
Credit c = new Credit();
|
||||
c.Amount = creditAmount;
|
||||
HibernateTemplate.Save(c);
|
||||
}
|
||||
}
|
||||
using Spring.Data.NHibernate.Support;
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
public class AccountCreditDao : HibernateDaoSupport, IAccountCreditDao
|
||||
{
|
||||
public void CreateCredit(float creditAmount)
|
||||
{
|
||||
Credit c = new Credit();
|
||||
c.Amount = creditAmount;
|
||||
HibernateTemplate.Save(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
using Spring.Data.NHibernate.Support;
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
public class AccountDebitDao : HibernateDaoSupport, IAccountDebitDao
|
||||
{
|
||||
public void DebitAccount(float debitAmount)
|
||||
{
|
||||
Debit d = new Debit();
|
||||
d.Amount = debitAmount;
|
||||
HibernateTemplate.Save(d);
|
||||
}
|
||||
}
|
||||
using Spring.Data.NHibernate.Support;
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
public class AccountDebitDao : HibernateDaoSupport, IAccountDebitDao
|
||||
{
|
||||
public void DebitAccount(float debitAmount)
|
||||
{
|
||||
Debit d = new Debit();
|
||||
d.Amount = debitAmount;
|
||||
HibernateTemplate.Save(d);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,95 +1,95 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright © 2002-2011 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.Transaction.Interceptor;
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
public class AccountManager : IAccountManager
|
||||
{
|
||||
|
||||
private IAccountCreditDao creditDao;
|
||||
private IAccountDebitDao debitDao;
|
||||
private IAuditDao auditDao;
|
||||
|
||||
private bool throwException = false;
|
||||
private bool throwExceptionAtEnd = false;
|
||||
|
||||
public AccountManager()
|
||||
{
|
||||
}
|
||||
|
||||
public IAccountCreditDao AccountCreditDao
|
||||
{
|
||||
get { return creditDao; }
|
||||
set { creditDao = value; }
|
||||
}
|
||||
|
||||
public IAccountDebitDao AccountDebitDao
|
||||
{
|
||||
get { return debitDao; }
|
||||
set { debitDao = value; }
|
||||
}
|
||||
|
||||
public IAuditDao AuditDao
|
||||
{
|
||||
get { return auditDao; }
|
||||
set { auditDao = value; }
|
||||
}
|
||||
|
||||
|
||||
public bool ThrowException
|
||||
{
|
||||
get { return throwException; }
|
||||
set { throwException = value; }
|
||||
}
|
||||
|
||||
public bool ThrowExceptionAtEnd
|
||||
{
|
||||
get { return throwExceptionAtEnd; }
|
||||
set { throwExceptionAtEnd = value; }
|
||||
}
|
||||
|
||||
|
||||
[Transaction()]
|
||||
public void DoTransfer(float creditAmount, float debitAmount)
|
||||
{
|
||||
creditDao.CreateCredit(creditAmount);
|
||||
if (ThrowException)
|
||||
{
|
||||
throw new ArithmeticException("Couldn't do the math....");
|
||||
}
|
||||
debitDao.DebitAccount(debitAmount);
|
||||
if (AuditDao != null)
|
||||
{
|
||||
AuditDao.AuditOperation(DateTime.Now.ToString());
|
||||
}
|
||||
if (ThrowExceptionAtEnd)
|
||||
{
|
||||
throw new ArgumentException("Almost there...but not quite.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright © 2002-2011 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.Transaction.Interceptor;
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
public class AccountManager : IAccountManager
|
||||
{
|
||||
|
||||
private IAccountCreditDao creditDao;
|
||||
private IAccountDebitDao debitDao;
|
||||
private IAuditDao auditDao;
|
||||
|
||||
private bool throwException = false;
|
||||
private bool throwExceptionAtEnd = false;
|
||||
|
||||
public AccountManager()
|
||||
{
|
||||
}
|
||||
|
||||
public IAccountCreditDao AccountCreditDao
|
||||
{
|
||||
get { return creditDao; }
|
||||
set { creditDao = value; }
|
||||
}
|
||||
|
||||
public IAccountDebitDao AccountDebitDao
|
||||
{
|
||||
get { return debitDao; }
|
||||
set { debitDao = value; }
|
||||
}
|
||||
|
||||
public IAuditDao AuditDao
|
||||
{
|
||||
get { return auditDao; }
|
||||
set { auditDao = value; }
|
||||
}
|
||||
|
||||
|
||||
public bool ThrowException
|
||||
{
|
||||
get { return throwException; }
|
||||
set { throwException = value; }
|
||||
}
|
||||
|
||||
public bool ThrowExceptionAtEnd
|
||||
{
|
||||
get { return throwExceptionAtEnd; }
|
||||
set { throwExceptionAtEnd = value; }
|
||||
}
|
||||
|
||||
|
||||
[Transaction()]
|
||||
public void DoTransfer(float creditAmount, float debitAmount)
|
||||
{
|
||||
creditDao.CreateCredit(creditAmount);
|
||||
if (ThrowException)
|
||||
{
|
||||
throw new ArithmeticException("Couldn't do the math....");
|
||||
}
|
||||
debitDao.DebitAccount(debitAmount);
|
||||
if (AuditDao != null)
|
||||
{
|
||||
AuditDao.AuditOperation(DateTime.Now.ToString());
|
||||
}
|
||||
if (ThrowExceptionAtEnd)
|
||||
{
|
||||
throw new ArgumentException("Almost there...but not quite.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,20 +1,20 @@
|
||||
using System.Data;
|
||||
using log4net;
|
||||
using Spring.Data.Core;
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
public class AuditDao : AdoDaoSupport, IAuditDao
|
||||
{
|
||||
protected static readonly ILog logger =
|
||||
LogManager.GetLogger(typeof(AuditDao));
|
||||
public void AuditOperation(string operationIdenfitier)
|
||||
{
|
||||
logger.Debug("Executing AUDIT operation.");
|
||||
AdoTemplate.ExecuteNonQuery(CommandType.Text,
|
||||
"insert into AuditTable (AuditId) values (@AuditId)",
|
||||
"AuditId", DbType.String, 100, operationIdenfitier);
|
||||
logger.Debug("AUDIT operation done.");
|
||||
}
|
||||
}
|
||||
using System.Data;
|
||||
using log4net;
|
||||
using Spring.Data.Core;
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
public class AuditDao : AdoDaoSupport, IAuditDao
|
||||
{
|
||||
protected static readonly ILog logger =
|
||||
LogManager.GetLogger(typeof(AuditDao));
|
||||
public void AuditOperation(string operationIdenfitier)
|
||||
{
|
||||
logger.Debug("Executing AUDIT operation.");
|
||||
AdoTemplate.ExecuteNonQuery(CommandType.Text,
|
||||
"insert into AuditTable (AuditId) values (@AuditId)",
|
||||
"AuditId", DbType.String, 100, operationIdenfitier);
|
||||
logger.Debug("AUDIT operation done.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,6 @@ namespace Spring.Data.NHibernate.Bytecode
|
||||
this.delimiter = delimiter;
|
||||
}
|
||||
|
||||
#if NH_5
|
||||
public object NullSafeGet(DbDataReader rs, string[] names, ISessionImplementor session, object owner)
|
||||
{
|
||||
string resultString = (string) NHibernateUtil.String.NullSafeGet(rs, names[0], session);
|
||||
@@ -37,28 +36,6 @@ namespace Spring.Data.NHibernate.Bytecode
|
||||
|
||||
NHibernateUtil.String.NullSafeSet(cmd, value, index, session);
|
||||
}
|
||||
#else
|
||||
public object NullSafeGet(IDataReader rs, string[] names, object owner)
|
||||
{
|
||||
string resultString = (string) NHibernateUtil.String.NullSafeGet(rs, names[0]);
|
||||
if (resultString != null)
|
||||
return delimiter.Delimit(resultString);
|
||||
return null;
|
||||
}
|
||||
|
||||
public void NullSafeSet(IDbCommand cmd, object value, int index)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
NHibernateUtil.String.NullSafeSet(cmd, null, index);
|
||||
return;
|
||||
}
|
||||
|
||||
value = delimiter.Delimit((string) value);
|
||||
|
||||
NHibernateUtil.String.NullSafeSet(cmd, value, index);
|
||||
}
|
||||
#endif
|
||||
|
||||
public object DeepCopy(object value)
|
||||
{
|
||||
@@ -1,63 +1,63 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright © 2002-2011 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
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
public class Credit
|
||||
{
|
||||
#region Fields
|
||||
|
||||
private int creditId;
|
||||
private float amount;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor (s)
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Credit"/> class.
|
||||
/// </summary>
|
||||
public Credit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public int CreditID
|
||||
{
|
||||
get { return creditId; }
|
||||
set { creditId = value; }
|
||||
}
|
||||
|
||||
public float Amount
|
||||
{
|
||||
get { return amount; }
|
||||
set { amount = value; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright © 2002-2011 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
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
public class Credit
|
||||
{
|
||||
#region Fields
|
||||
|
||||
private int creditId;
|
||||
private float amount;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor (s)
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Credit"/> class.
|
||||
/// </summary>
|
||||
public Credit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public int CreditID
|
||||
{
|
||||
get { return creditId; }
|
||||
set { creditId = value; }
|
||||
}
|
||||
|
||||
public float Amount
|
||||
{
|
||||
get { return amount; }
|
||||
set { amount = value; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,77 +1,77 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright <EFBFBD> 2002-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
#region Imports
|
||||
|
||||
using NUnit.Framework;
|
||||
using Spring.Context;
|
||||
using Spring.Context.Support;
|
||||
using Spring.Data.Common;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
/// <summary>
|
||||
/// This class contains tests for execution of misc Hibernate usage, including userCredentialsDbProvider
|
||||
/// </summary>
|
||||
/// <author>Mark Pollack</author>
|
||||
[TestFixture]
|
||||
public class DbProviderTemplateTests
|
||||
{
|
||||
private IApplicationContext ctx;
|
||||
private UserCredentialsDbProvider userCredentialsDbProvider;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
//BasicConfigurator.Configure();
|
||||
string assemblyName = GetType().Assembly.GetName().Name;
|
||||
ctx = new XmlApplicationContext("assembly://" + assemblyName + "/Spring.Data.NHibernate/dbProviderTemplateTests.xml");
|
||||
|
||||
userCredentialsDbProvider = ctx["DbProvider"] as UserCredentialsDbProvider;
|
||||
Assert.IsNotNull(userCredentialsDbProvider);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("Trouble running on Appveyor")]
|
||||
public void UserCredentialsDbProvider()
|
||||
{
|
||||
ITestObjectDao dao = (ITestObjectDao)ctx["testObjectDaoTransProxy"];
|
||||
|
||||
userCredentialsDbProvider.SetCredentialsForCurrentThread("User ID=springqa", "Password=springqa");
|
||||
TestObject toGeorge = new TestObject();
|
||||
toGeorge.Name = "George";
|
||||
toGeorge.Age = 33;
|
||||
dao.Create(toGeorge);
|
||||
|
||||
userCredentialsDbProvider.SetCredentialsForCurrentThread("User ID=springqa2", "Password=springqa2");
|
||||
|
||||
TestObject toMary = new TestObject();
|
||||
toMary.Name = "Mary";
|
||||
toMary.Age = 34;
|
||||
dao.Create(toMary);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright <EFBFBD> 2002-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
#region Imports
|
||||
|
||||
using NUnit.Framework;
|
||||
using Spring.Context;
|
||||
using Spring.Context.Support;
|
||||
using Spring.Data.Common;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
/// <summary>
|
||||
/// This class contains tests for execution of misc Hibernate usage, including userCredentialsDbProvider
|
||||
/// </summary>
|
||||
/// <author>Mark Pollack</author>
|
||||
[TestFixture]
|
||||
public class DbProviderTemplateTests
|
||||
{
|
||||
private IApplicationContext ctx;
|
||||
private UserCredentialsDbProvider userCredentialsDbProvider;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
//BasicConfigurator.Configure();
|
||||
string assemblyName = GetType().Assembly.GetName().Name;
|
||||
ctx = new XmlApplicationContext("assembly://" + assemblyName + "/Spring.Data.NHibernate/dbProviderTemplateTests.xml");
|
||||
|
||||
userCredentialsDbProvider = ctx["DbProvider"] as UserCredentialsDbProvider;
|
||||
Assert.IsNotNull(userCredentialsDbProvider);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("Trouble running on Appveyor")]
|
||||
public void UserCredentialsDbProvider()
|
||||
{
|
||||
ITestObjectDao dao = (ITestObjectDao)ctx["testObjectDaoTransProxy"];
|
||||
|
||||
userCredentialsDbProvider.SetCredentialsForCurrentThread("User ID=springqa", "Password=springqa");
|
||||
TestObject toGeorge = new TestObject();
|
||||
toGeorge.Name = "George";
|
||||
toGeorge.Age = 33;
|
||||
dao.Create(toGeorge);
|
||||
|
||||
userCredentialsDbProvider.SetCredentialsForCurrentThread("User ID=springqa2", "Password=springqa2");
|
||||
|
||||
TestObject toMary = new TestObject();
|
||||
toMary.Name = "Mary";
|
||||
toMary.Age = 34;
|
||||
dao.Create(toMary);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,63 +1,63 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright © 2002-2011 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
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
public class Debit
|
||||
{
|
||||
#region Fields
|
||||
|
||||
private int debitId;
|
||||
private float amount;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor (s)
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Credit"/> class.
|
||||
/// </summary>
|
||||
public Debit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public int DebitID
|
||||
{
|
||||
get { return debitId; }
|
||||
set { debitId = value; }
|
||||
}
|
||||
|
||||
public float Amount
|
||||
{
|
||||
get { return amount; }
|
||||
set { amount = value; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright © 2002-2011 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
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
public class Debit
|
||||
{
|
||||
#region Fields
|
||||
|
||||
private int debitId;
|
||||
private float amount;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor (s)
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Credit"/> class.
|
||||
/// </summary>
|
||||
public Debit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public int DebitID
|
||||
{
|
||||
get { return debitId; }
|
||||
set { debitId = value; }
|
||||
}
|
||||
|
||||
public float Amount
|
||||
{
|
||||
get { return amount; }
|
||||
set { amount = value; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
public interface IAccountCreditDao
|
||||
{
|
||||
void CreateCredit(float creditAmount);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
public interface IAccountCreditDao
|
||||
{
|
||||
void CreateCredit(float creditAmount);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
public interface IAccountDebitDao
|
||||
{
|
||||
void DebitAccount(float debitAmount);
|
||||
}
|
||||
}
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
public interface IAccountDebitDao
|
||||
{
|
||||
void DebitAccount(float debitAmount);
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,17 @@
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
public interface IAccountManager
|
||||
{
|
||||
void DoTransfer(float creditAmount, float debitAmount);
|
||||
|
||||
/// <summary>
|
||||
/// For testing purposes...
|
||||
/// </summary>
|
||||
bool ThrowException
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
public interface IAccountManager
|
||||
{
|
||||
void DoTransfer(float creditAmount, float debitAmount);
|
||||
|
||||
/// <summary>
|
||||
/// For testing purposes...
|
||||
/// </summary>
|
||||
bool ThrowException
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,28 +1,28 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright © 2002-2011 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
|
||||
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
public interface IAuditDao
|
||||
{
|
||||
void AuditOperation(string operationIdenfitier);
|
||||
}
|
||||
}
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright © 2002-2011 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
|
||||
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
public interface IAuditDao
|
||||
{
|
||||
void AuditOperation(string operationIdenfitier);
|
||||
}
|
||||
}
|
||||
@@ -1,40 +1,41 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright © 2002-2011 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
|
||||
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
/// <summary>
|
||||
/// TODO:
|
||||
/// </summary>
|
||||
/// <author>Mark Pollack (.NET)</author>
|
||||
public interface ITestObjectDao
|
||||
{
|
||||
void Create(TestObject to);
|
||||
void Update(TestObject to);
|
||||
void Delete(TestObject to);
|
||||
TestObject FindByName(string name);
|
||||
//IList FindAll();
|
||||
//int GetCount();
|
||||
//int GetCountByDelegate();
|
||||
void CreateUpdateRollback(TestObject to);
|
||||
|
||||
}
|
||||
}
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright © 2002-2011 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
|
||||
|
||||
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
/// <summary>
|
||||
/// TODO:
|
||||
/// </summary>
|
||||
/// <author>Mark Pollack (.NET)</author>
|
||||
public interface ITestObjectDao
|
||||
{
|
||||
void Create(TestObject to);
|
||||
void Update(TestObject to);
|
||||
void Delete(TestObject to);
|
||||
TestObject FindByName(string name);
|
||||
//IList FindAll();
|
||||
//int GetCount();
|
||||
//int GetCountByDelegate();
|
||||
void CreateUpdateRollback(TestObject to);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,109 +1,109 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright © 2002-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
#region Imports
|
||||
|
||||
using log4net;
|
||||
using NHibernate;
|
||||
using NUnit.Framework;
|
||||
using Spring.Context;
|
||||
using Spring.Context.Support;
|
||||
using Spring.Data.NHibernate.Support;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
/// <summary>
|
||||
/// Use of Hibernate Template against database.
|
||||
/// </summary>
|
||||
/// <author>Mark Pollack (.NET)</author>
|
||||
[TestFixture]
|
||||
[Ignore("Trouble running on Appveyor")]
|
||||
public class MultipleDbTests
|
||||
{
|
||||
#region Fields
|
||||
|
||||
private IApplicationContext ctx;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Constants
|
||||
|
||||
/// <summary>
|
||||
/// The shared <see cref="log4net.ILog"/> instance for this class (and derived classes).
|
||||
/// </summary>
|
||||
protected static readonly ILog log =
|
||||
LogManager.GetLogger(typeof(TemplateTests));
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor (s)
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MultipleDbTests"/> class.
|
||||
/// </summary>
|
||||
public MultipleDbTests()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
//BasicConfigurator.Configure();
|
||||
string assemblyName = GetType().Assembly.GetName().Name;
|
||||
ctx = new XmlApplicationContext("assembly://" + assemblyName + "/Spring.Data.NHibernate/MultipleDbTests.xml");
|
||||
}
|
||||
|
||||
// TODO: this test fails - check out why
|
||||
[Test]
|
||||
public void MultipleDBAccess()
|
||||
{
|
||||
float transferAmount = 114;
|
||||
IAccountManager mgr = null;
|
||||
|
||||
Assert.IsNotNull(ctx, "Application Context is null");
|
||||
mgr = ctx["accountManager"] as IAccountManager;
|
||||
Assert.IsNotNull(mgr, "accountManager not of expected type. Type = " + ctx["accountManager"].GetType());
|
||||
mgr.DoTransfer(transferAmount, transferAmount);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MultipleDBAccessUsingMultipleSessionScopes()
|
||||
{
|
||||
SessionScope scope1 = new SessionScope( (ISessionFactory) ctx["SessionFactory1"], false );
|
||||
SessionScope scope2 = new SessionScope( (ISessionFactory) ctx["SessionFactory2"], false );
|
||||
|
||||
scope1.Open();
|
||||
scope2.Open();
|
||||
|
||||
// do something
|
||||
MultipleDBAccess();
|
||||
|
||||
scope1.Close();
|
||||
scope2.Close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright © 2002-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
#region Imports
|
||||
|
||||
using log4net;
|
||||
using NHibernate;
|
||||
using NUnit.Framework;
|
||||
using Spring.Context;
|
||||
using Spring.Context.Support;
|
||||
using Spring.Data.NHibernate.Support;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
/// <summary>
|
||||
/// Use of Hibernate Template against database.
|
||||
/// </summary>
|
||||
/// <author>Mark Pollack (.NET)</author>
|
||||
[TestFixture]
|
||||
[Ignore("Trouble running on Appveyor")]
|
||||
public class MultipleDbTests
|
||||
{
|
||||
#region Fields
|
||||
|
||||
private IApplicationContext ctx;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Constants
|
||||
|
||||
/// <summary>
|
||||
/// The shared <see cref="log4net.ILog"/> instance for this class (and derived classes).
|
||||
/// </summary>
|
||||
protected static readonly ILog log =
|
||||
LogManager.GetLogger(typeof(TemplateTests));
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor (s)
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MultipleDbTests"/> class.
|
||||
/// </summary>
|
||||
public MultipleDbTests()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
//BasicConfigurator.Configure();
|
||||
string assemblyName = GetType().Assembly.GetName().Name;
|
||||
ctx = new XmlApplicationContext("assembly://" + assemblyName + "/Spring.Data.NHibernate/MultipleDbTests.xml");
|
||||
}
|
||||
|
||||
// TODO: this test fails - check out why
|
||||
[Test]
|
||||
public void MultipleDBAccess()
|
||||
{
|
||||
float transferAmount = 114;
|
||||
IAccountManager mgr = null;
|
||||
|
||||
Assert.IsNotNull(ctx, "Application Context is null");
|
||||
mgr = ctx["accountManager"] as IAccountManager;
|
||||
Assert.IsNotNull(mgr, "accountManager not of expected type. Type = " + ctx["accountManager"].GetType());
|
||||
mgr.DoTransfer(transferAmount, transferAmount);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MultipleDBAccessUsingMultipleSessionScopes()
|
||||
{
|
||||
SessionScope scope1 = new SessionScope( (ISessionFactory) ctx["SessionFactory1"], false );
|
||||
SessionScope scope2 = new SessionScope( (ISessionFactory) ctx["SessionFactory2"], false );
|
||||
|
||||
scope1.Open();
|
||||
scope2.Open();
|
||||
|
||||
// do something
|
||||
MultipleDBAccess();
|
||||
|
||||
scope1.Close();
|
||||
scope2.Close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,119 +1,119 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright © 2002-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using NHibernate;
|
||||
using NUnit.Framework;
|
||||
using Spring.Context;
|
||||
using Spring.Context.Support;
|
||||
using Spring.Data.Common;
|
||||
using Spring.Data.NHibernate.Support;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
[TestFixture]
|
||||
public class NHDAOTests
|
||||
{
|
||||
private IApplicationContext ctx;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
//BasicConfigurator.Configure();
|
||||
string assemblyName = GetType().Assembly.GetName().Name;
|
||||
//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))
|
||||
{
|
||||
ContextRegistry.RegisterContext(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DbProviderTranslation()
|
||||
{
|
||||
ISessionFactory sf = ctx["SessionFactory"] as ISessionFactory;
|
||||
IDbProvider dbProvider = SessionFactoryUtils.GetDbProvider(sf);
|
||||
|
||||
Assert.That(dbProvider.DbMetadata.ProductName, Does.Contain("Microsoft SQL Server"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SessionScopeOutsideTransaction()
|
||||
{
|
||||
float transferAmount = 113;
|
||||
using (new SessionScope())
|
||||
{
|
||||
IAccountManager mgr = null;
|
||||
mgr = ctx["accountManager"] as IAccountManager;
|
||||
Assert.IsNotNull(mgr, "accountManager not of expected type. Type = " + ctx["accountManager"].GetType());
|
||||
mgr.DoTransfer(transferAmount, transferAmount);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DeclarativeWithAttributes()
|
||||
{
|
||||
float transferAmount = 113;
|
||||
IAccountManager mgr = null;
|
||||
try
|
||||
{
|
||||
Assert.IsNotNull(ctx,"Application Context is null");
|
||||
mgr = ctx["accountManager"] as IAccountManager;
|
||||
Assert.IsNotNull(mgr,"accountManager not of expected type. Type = " + ctx["accountManager"].GetType().ToString());
|
||||
mgr.DoTransfer(transferAmount, transferAmount);
|
||||
Assert.IsTrue(ContainsNewData(transferAmount));
|
||||
} catch (Exception e)
|
||||
{
|
||||
if (mgr.ThrowException)
|
||||
{
|
||||
Console.WriteLine(e.Message);
|
||||
Console.WriteLine(e.StackTrace);
|
||||
Assert.IsTrue(DoesNotContainNewData(transferAmount));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool ContainsNewData(float amount)
|
||||
{
|
||||
//to be done
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool DoesNotContainNewData(float amount)
|
||||
{
|
||||
//to be done
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright © 2002-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using NHibernate;
|
||||
using NUnit.Framework;
|
||||
using Spring.Context;
|
||||
using Spring.Context.Support;
|
||||
using Spring.Data.Common;
|
||||
using Spring.Data.NHibernate.Support;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
[TestFixture]
|
||||
public class NHDAOTests
|
||||
{
|
||||
private IApplicationContext ctx;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
//BasicConfigurator.Configure();
|
||||
string assemblyName = GetType().Assembly.GetName().Name;
|
||||
//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))
|
||||
{
|
||||
ContextRegistry.RegisterContext(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DbProviderTranslation()
|
||||
{
|
||||
ISessionFactory sf = ctx["SessionFactory"] as ISessionFactory;
|
||||
IDbProvider dbProvider = SessionFactoryUtils.GetDbProvider(sf);
|
||||
|
||||
Assert.That(dbProvider.DbMetadata.ProductName, Does.Contain("Microsoft SQL Server"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SessionScopeOutsideTransaction()
|
||||
{
|
||||
float transferAmount = 113;
|
||||
using (new SessionScope())
|
||||
{
|
||||
IAccountManager mgr = null;
|
||||
mgr = ctx["accountManager"] as IAccountManager;
|
||||
Assert.IsNotNull(mgr, "accountManager not of expected type. Type = " + ctx["accountManager"].GetType());
|
||||
mgr.DoTransfer(transferAmount, transferAmount);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DeclarativeWithAttributes()
|
||||
{
|
||||
float transferAmount = 113;
|
||||
IAccountManager mgr = null;
|
||||
try
|
||||
{
|
||||
Assert.IsNotNull(ctx,"Application Context is null");
|
||||
mgr = ctx["accountManager"] as IAccountManager;
|
||||
Assert.IsNotNull(mgr,"accountManager not of expected type. Type = " + ctx["accountManager"].GetType().ToString());
|
||||
mgr.DoTransfer(transferAmount, transferAmount);
|
||||
Assert.IsTrue(ContainsNewData(transferAmount));
|
||||
} catch (Exception e)
|
||||
{
|
||||
if (mgr.ThrowException)
|
||||
{
|
||||
Console.WriteLine(e.Message);
|
||||
Console.WriteLine(e.StackTrace);
|
||||
Assert.IsTrue(DoesNotContainNewData(transferAmount));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool ContainsNewData(float amount)
|
||||
{
|
||||
//to be done
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool DoesNotContainNewData(float amount)
|
||||
{
|
||||
//to be done
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,96 +1,96 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright © 2002-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
using NHibernate.Type;
|
||||
|
||||
using Spring.Data.NHibernate.Support;
|
||||
using Spring.Transaction.Interceptor;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
public class NHTestObjectDao : HibernateDaoSupport, ITestObjectDao
|
||||
{
|
||||
#region Constructor (s)
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NHTestObjectDao"/> class.
|
||||
/// </summary>
|
||||
public NHTestObjectDao()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ITestObjectDao Members
|
||||
|
||||
[Transaction()]
|
||||
public void Create(TestObject to)
|
||||
{
|
||||
HibernateTemplate.Save(to);
|
||||
}
|
||||
|
||||
[Transaction()]
|
||||
public void Update(TestObject to)
|
||||
{
|
||||
HibernateTemplate.Update(to);
|
||||
}
|
||||
|
||||
[Transaction()]
|
||||
public void Delete(TestObject to)
|
||||
{
|
||||
HibernateTemplate.Delete(to);
|
||||
}
|
||||
|
||||
public TestObject FindByName(string name)
|
||||
{
|
||||
IList result = HibernateTemplate.Find(
|
||||
"from TestObject to where to.Name=?",
|
||||
name,
|
||||
TypeFactory.GetStringType(50)
|
||||
);
|
||||
|
||||
if (result.Count > 0)
|
||||
{
|
||||
return (TestObject) result[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void CreateUpdateRollback(TestObject to)
|
||||
{
|
||||
HibernateTemplate.Save(to);
|
||||
to.Name = "Updated Name";
|
||||
HibernateTemplate.Update(to);
|
||||
throw new Exception("My expected exception for test purposes.");
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright © 2002-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
using NHibernate.Type;
|
||||
|
||||
using Spring.Data.NHibernate.Support;
|
||||
using Spring.Transaction.Interceptor;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
public class NHTestObjectDao : HibernateDaoSupport, ITestObjectDao
|
||||
{
|
||||
#region Constructor (s)
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NHTestObjectDao"/> class.
|
||||
/// </summary>
|
||||
public NHTestObjectDao()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ITestObjectDao Members
|
||||
|
||||
[Transaction()]
|
||||
public void Create(TestObject to)
|
||||
{
|
||||
HibernateTemplate.Save(to);
|
||||
}
|
||||
|
||||
[Transaction()]
|
||||
public void Update(TestObject to)
|
||||
{
|
||||
HibernateTemplate.Update(to);
|
||||
}
|
||||
|
||||
[Transaction()]
|
||||
public void Delete(TestObject to)
|
||||
{
|
||||
HibernateTemplate.Delete(to);
|
||||
}
|
||||
|
||||
public TestObject FindByName(string name)
|
||||
{
|
||||
IList result = HibernateTemplate.Find(
|
||||
"from TestObject to where to.Name=?",
|
||||
name,
|
||||
TypeFactory.GetStringType(50)
|
||||
);
|
||||
|
||||
if (result.Count > 0)
|
||||
{
|
||||
return (TestObject) result[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void CreateUpdateRollback(TestObject to)
|
||||
{
|
||||
HibernateTemplate.Save(to);
|
||||
to.Name = "Updated Name";
|
||||
HibernateTemplate.Update(to);
|
||||
throw new Exception("My expected exception for test purposes.");
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,109 +1,109 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright © 2002-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
#region Imports
|
||||
|
||||
using NHibernate;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
public class NativeNHTestObjectDao : ITestObjectDao
|
||||
{
|
||||
public ISessionFactory SessionFactory
|
||||
{
|
||||
get { return sessionFactory; }
|
||||
set { sessionFactory = value; }
|
||||
}
|
||||
|
||||
private ISessionFactory sessionFactory;
|
||||
|
||||
#region Constructor (s)
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NativeNHTestObjectDao"/> class.
|
||||
/// </summary>
|
||||
public NativeNHTestObjectDao()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Methods
|
||||
|
||||
#endregion
|
||||
|
||||
#region ITestObjectDao Members
|
||||
|
||||
public void Create(TestObject to)
|
||||
{
|
||||
ISession session = null;
|
||||
ITransaction transaction = null;
|
||||
|
||||
try
|
||||
{
|
||||
session = SessionFactory.OpenSession();
|
||||
|
||||
transaction = session.BeginTransaction();
|
||||
|
||||
session.Save(to);
|
||||
|
||||
transaction.Commit();
|
||||
}
|
||||
catch
|
||||
{
|
||||
if(transaction != null)
|
||||
transaction.Rollback();
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if(session != null)
|
||||
session.Close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void Update(TestObject to)
|
||||
{
|
||||
// TODO: Add NativeNHTestObjectDao.Update implementation
|
||||
}
|
||||
|
||||
public void Delete(TestObject to)
|
||||
{
|
||||
// TODO: Add NativeNHTestObjectDao.Delete implementation
|
||||
}
|
||||
|
||||
public TestObject FindByName(string name)
|
||||
{
|
||||
// TODO: Add NativeNHTestObjectDao.FindByName implementation
|
||||
return null;
|
||||
}
|
||||
|
||||
public void CreateUpdateRollback(TestObject to)
|
||||
{
|
||||
// TODO: Add NativeNHTestObjectDao.CreateUpdateRollback implementation
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright © 2002-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
#region Imports
|
||||
|
||||
using NHibernate;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
public class NativeNHTestObjectDao : ITestObjectDao
|
||||
{
|
||||
public ISessionFactory SessionFactory
|
||||
{
|
||||
get { return sessionFactory; }
|
||||
set { sessionFactory = value; }
|
||||
}
|
||||
|
||||
private ISessionFactory sessionFactory;
|
||||
|
||||
#region Constructor (s)
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NativeNHTestObjectDao"/> class.
|
||||
/// </summary>
|
||||
public NativeNHTestObjectDao()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Methods
|
||||
|
||||
#endregion
|
||||
|
||||
#region ITestObjectDao Members
|
||||
|
||||
public void Create(TestObject to)
|
||||
{
|
||||
ISession session = null;
|
||||
ITransaction transaction = null;
|
||||
|
||||
try
|
||||
{
|
||||
session = SessionFactory.OpenSession();
|
||||
|
||||
transaction = session.BeginTransaction();
|
||||
|
||||
session.Save(to);
|
||||
|
||||
transaction.Commit();
|
||||
}
|
||||
catch
|
||||
{
|
||||
if(transaction != null)
|
||||
transaction.Rollback();
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if(session != null)
|
||||
session.Close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void Update(TestObject to)
|
||||
{
|
||||
// TODO: Add NativeNHTestObjectDao.Update implementation
|
||||
}
|
||||
|
||||
public void Delete(TestObject to)
|
||||
{
|
||||
// TODO: Add NativeNHTestObjectDao.Delete implementation
|
||||
}
|
||||
|
||||
public TestObject FindByName(string name)
|
||||
{
|
||||
// TODO: Add NativeNHTestObjectDao.FindByName implementation
|
||||
return null;
|
||||
}
|
||||
|
||||
public void CreateUpdateRollback(TestObject to)
|
||||
{
|
||||
// TODO: Add NativeNHTestObjectDao.CreateUpdateRollback implementation
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,67 +1,67 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright © 2002-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
#region Imports
|
||||
|
||||
using NUnit.Framework;
|
||||
using Spring.Context;
|
||||
using Spring.Context.Support;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
[TestFixture]
|
||||
public class NativeNHTests
|
||||
{
|
||||
|
||||
#region Constructor (s)
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NativeNHTests"/> class.
|
||||
/// </summary>
|
||||
public NativeNHTests()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Methods
|
||||
|
||||
[Test]
|
||||
public void CreateNative()
|
||||
{
|
||||
IApplicationContext ctx;
|
||||
string assemblyName = GetType().Assembly.GetName().Name;
|
||||
ctx = new XmlApplicationContext("assembly://" + assemblyName + "/Spring.Data.NHibernate/templateTests.xml");
|
||||
|
||||
ITestObjectDao dao = (ITestObjectDao)ctx.GetObject("nativeNHTestObjectDao");
|
||||
|
||||
TestObject toGeorge = new TestObject();
|
||||
toGeorge.Name = "George";
|
||||
toGeorge.Age = 34;
|
||||
dao.Create(toGeorge);
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright © 2002-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
#region Imports
|
||||
|
||||
using NUnit.Framework;
|
||||
using Spring.Context;
|
||||
using Spring.Context.Support;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
[TestFixture]
|
||||
public class NativeNHTests
|
||||
{
|
||||
|
||||
#region Constructor (s)
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NativeNHTests"/> class.
|
||||
/// </summary>
|
||||
public NativeNHTests()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Methods
|
||||
|
||||
[Test]
|
||||
public void CreateNative()
|
||||
{
|
||||
IApplicationContext ctx;
|
||||
string assemblyName = GetType().Assembly.GetName().Name;
|
||||
ctx = new XmlApplicationContext("assembly://" + assemblyName + "/Spring.Data.NHibernate/templateTests.xml");
|
||||
|
||||
ITestObjectDao dao = (ITestObjectDao)ctx.GetObject("nativeNHTestObjectDao");
|
||||
|
||||
TestObject toGeorge = new TestObject();
|
||||
toGeorge.Name = "George";
|
||||
toGeorge.Age = 34;
|
||||
dao.Create(toGeorge);
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,290 +1,290 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright © 2002-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
using log4net;
|
||||
|
||||
using NHibernate;
|
||||
using NUnit.Framework;
|
||||
using Spring.Context;
|
||||
using Spring.Context.Support;
|
||||
using Spring.Data.Common;
|
||||
using Spring.Data.Support;
|
||||
using Spring.Transaction;
|
||||
using Spring.Transaction.Support;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
/// <summary>
|
||||
/// Use of Hibernate Template against database.
|
||||
/// </summary>
|
||||
/// <author>Mark Pollack (.NET)</author>
|
||||
[TestFixture]
|
||||
public class TemplateTests
|
||||
{
|
||||
#region Fields
|
||||
private IDbProvider dbProvider;
|
||||
|
||||
private IPlatformTransactionManager transactionManager;
|
||||
|
||||
private IApplicationContext ctx;
|
||||
#endregion
|
||||
|
||||
#region Constants
|
||||
|
||||
/// <summary>
|
||||
/// The shared <see cref="log4net.ILog"/> instance for this class (and derived classes).
|
||||
/// </summary>
|
||||
protected static readonly ILog log =
|
||||
LogManager.GetLogger(typeof (TemplateTests));
|
||||
|
||||
// force Spring.Data.NHibernate to be preloaded by runtime
|
||||
private Type TLocalSessionFactoryObject = typeof (LocalSessionFactoryObject);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor (s)
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TemplateTests"/> class.
|
||||
/// </summary>
|
||||
public TemplateTests()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
//NamespaceParserRegistry.RegisterParser(typeof(DatabaseNamespaceParser));
|
||||
//BasicConfigurator.Configure();
|
||||
string assemblyName = GetType().Assembly.GetName().Name;
|
||||
ctx = new XmlApplicationContext("assembly://" + assemblyName + "/Spring.Data.NHibernate/templateTests.xml");
|
||||
|
||||
dbProvider = ctx["DbProvider"] as IDbProvider;
|
||||
transactionManager = ctx["hibernateTransactionManager"] as IPlatformTransactionManager;
|
||||
CleanupDatabase(dbProvider.CreateConnection());
|
||||
}
|
||||
|
||||
private static void CleanupDatabase(IDbConnection conn)
|
||||
{
|
||||
conn.Open();
|
||||
using(conn)
|
||||
{
|
||||
ExecuteSql(conn, "delete credits");
|
||||
ExecuteSql(conn, "delete debits");
|
||||
ExecuteSql(conn, "delete TestObjects");
|
||||
ExecuteSql(conn, "insert TestObjects(Age,Name) Values(5, 'Gabriel')");
|
||||
}
|
||||
}
|
||||
|
||||
private static void ExecuteSql(IDbConnection conn, string sql)
|
||||
{
|
||||
IDbCommand cmd;
|
||||
cmd = conn.CreateCommand();
|
||||
cmd.CommandText = sql;
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ExceptionTranslator()
|
||||
{
|
||||
ISessionFactory sessionFactory = ctx["SessionFactory"] as ISessionFactory;
|
||||
HibernateTemplate template = new HibernateTemplate(sessionFactory);
|
||||
IAdoExceptionTranslator translator = template.AdoExceptionTranslator;
|
||||
Assert.IsNotNull(translator, "ADO.NET exception translator should not be null");
|
||||
|
||||
Assert.That(translator, Is.InstanceOf(typeof(ErrorCodeExceptionTranslator)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("what's the purpose of this test?")] // TODO: what's the purpose of this test?
|
||||
public void FallbackExceptionTranslator()
|
||||
{
|
||||
//ISessionFactory sessionFactory = ctx["SessionFactory"] as ISessionFactory;
|
||||
//HibernateTemplate template = new HibernateTemplate(sessionFactory);
|
||||
IAdoExceptionTranslator fallbackTranslator = new FallbackExceptionTranslator();
|
||||
fallbackTranslator.Translate("test", "sql", new Exception("foo"));
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("Just for demo purposes")]
|
||||
public void DemoDao()
|
||||
{
|
||||
|
||||
ITestObjectDao dao = (ITestObjectDao)ctx["testObjectDaoViaTxAttributes"];
|
||||
TestObject toGeorge = new TestObject();
|
||||
toGeorge.Name = "George";
|
||||
toGeorge.Age = 33;
|
||||
dao.Create(toGeorge);
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("Just for demo purposes")]
|
||||
public void SimpleDao()
|
||||
{
|
||||
ITestObjectDao dao = (ITestObjectDao)ctx["NHTestObjectDao"];
|
||||
Assert.IsNotNull(dao);
|
||||
TestObject to = dao.FindByName("Gabriel");
|
||||
Assert.IsNotNull(to);
|
||||
Assert.AreEqual("Gabriel", to.Name);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test simple data base operations using attributes for
|
||||
/// declarative transaction demarcation.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void DaoOperationsViaProxyFactoryWithTxAttributes()
|
||||
{
|
||||
|
||||
ITestObjectDao dao = (ITestObjectDao)ctx["testObjectDaoViaTxAttributes"];
|
||||
ExecuteDaoOperations(dao);
|
||||
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void DaoOperationsViaTransactionProxy()
|
||||
{
|
||||
|
||||
ITestObjectDao dao = (ITestObjectDao)ctx["testObjectDaoTransProxy"];
|
||||
ExecuteDaoOperations(dao);
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DaoOperationsWithRollback()
|
||||
{
|
||||
ITestObjectDao dao = (ITestObjectDao)ctx["testObjectDaoTransProxy"];
|
||||
try
|
||||
{
|
||||
ExecuteAndRollbackDaoOperations(dao);
|
||||
} catch (Exception e)
|
||||
{
|
||||
TestObject to = dao.FindByName("Bugs");
|
||||
Assert.IsNull(to);
|
||||
|
||||
//just to get rid of compiler warning...
|
||||
Assert.IsNotNull(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static void ExecuteAndRollbackDaoOperations(ITestObjectDao dao)
|
||||
{
|
||||
TestObject toBugs = new TestObject();
|
||||
toBugs.Name = "Bugs";
|
||||
toBugs.Age = 33;
|
||||
dao.CreateUpdateRollback(toBugs);
|
||||
|
||||
}
|
||||
private static void ExecuteDaoOperations(ITestObjectDao dao)
|
||||
{
|
||||
TestObject toGeorge = new TestObject();
|
||||
toGeorge.Name = "George";
|
||||
toGeorge.Age = 33;
|
||||
dao.Create(toGeorge);
|
||||
TestObject to = dao.FindByName("George");
|
||||
Assert.IsNotNull(to, "FindByName for George should not return null");
|
||||
Assert.AreEqual("George", to.Name);
|
||||
Assert.AreEqual(33, to.Age);
|
||||
|
||||
to.Age=34;
|
||||
dao.Update(to);
|
||||
|
||||
TestObject to2 = dao.FindByName("George");
|
||||
Assert.AreEqual(34, to2.Age);
|
||||
|
||||
dao.Delete(to);
|
||||
|
||||
TestObject to3 = dao.FindByName("George");
|
||||
Assert.IsNull(to3, "Should not have found TestObject with name George. TestObject = " + to.ToString() );
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void ExecuteTemplate()
|
||||
{
|
||||
ITestObjectDao dao = (ITestObjectDao)ctx["NHTestObjectDao"];
|
||||
TransactionTemplate tt = new TransactionTemplate(transactionManager);
|
||||
object result = tt.Execute(new SimpleTransactionCallback(dbProvider, dao));
|
||||
TestObject to = result as TestObject;
|
||||
Assert.IsNotNull(to,"FindByName for Gabriel should not return null");
|
||||
Assert.AreEqual("Gabriel", to.Name);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ExecuteTransactionManager()
|
||||
{
|
||||
DefaultTransactionDefinition def = new DefaultTransactionDefinition();
|
||||
def.PropagationBehavior = TransactionPropagation.Required;
|
||||
|
||||
ITransactionStatus status = transactionManager.GetTransaction(def);
|
||||
|
||||
ITestObjectDao dao = (ITestObjectDao)ctx["NHTestObjectDao"];
|
||||
TestObject to;
|
||||
try
|
||||
{
|
||||
to = dao.FindByName("Gabriel");
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
transactionManager.Rollback(status);
|
||||
throw;
|
||||
}
|
||||
transactionManager.Commit(status);
|
||||
Assert.IsNotNull(to,"FindByName for Gabriel should not return null");
|
||||
Assert.AreEqual("Gabriel", to.Name);
|
||||
}
|
||||
|
||||
private class SimpleTransactionCallback : ITransactionCallback
|
||||
{
|
||||
private IDbProvider dbProvider;
|
||||
private ITestObjectDao dao;
|
||||
|
||||
public SimpleTransactionCallback(IDbProvider dbp, ITestObjectDao dao)
|
||||
{
|
||||
dbProvider = dbp;
|
||||
this.dao = dao;
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets called by TransactionTemplate.Execute within a
|
||||
/// transaction context.
|
||||
/// </summary>
|
||||
/// <param name="status">The associated transaction status.</param>
|
||||
/// <returns>a result object or <c>null</c></returns>
|
||||
public object DoInTransaction(ITransactionStatus status)
|
||||
{
|
||||
return dao.FindByName("Gabriel");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright © 2002-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
using log4net;
|
||||
|
||||
using NHibernate;
|
||||
using NUnit.Framework;
|
||||
using Spring.Context;
|
||||
using Spring.Context.Support;
|
||||
using Spring.Data.Common;
|
||||
using Spring.Data.Support;
|
||||
using Spring.Transaction;
|
||||
using Spring.Transaction.Support;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
/// <summary>
|
||||
/// Use of Hibernate Template against database.
|
||||
/// </summary>
|
||||
/// <author>Mark Pollack (.NET)</author>
|
||||
[TestFixture]
|
||||
public class TemplateTests
|
||||
{
|
||||
#region Fields
|
||||
private IDbProvider dbProvider;
|
||||
|
||||
private IPlatformTransactionManager transactionManager;
|
||||
|
||||
private IApplicationContext ctx;
|
||||
#endregion
|
||||
|
||||
#region Constants
|
||||
|
||||
/// <summary>
|
||||
/// The shared <see cref="log4net.ILog"/> instance for this class (and derived classes).
|
||||
/// </summary>
|
||||
protected static readonly ILog log =
|
||||
LogManager.GetLogger(typeof (TemplateTests));
|
||||
|
||||
// force Spring.Data.NHibernate to be preloaded by runtime
|
||||
private Type TLocalSessionFactoryObject = typeof (LocalSessionFactoryObject);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor (s)
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TemplateTests"/> class.
|
||||
/// </summary>
|
||||
public TemplateTests()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
//NamespaceParserRegistry.RegisterParser(typeof(DatabaseNamespaceParser));
|
||||
//BasicConfigurator.Configure();
|
||||
string assemblyName = GetType().Assembly.GetName().Name;
|
||||
ctx = new XmlApplicationContext("assembly://" + assemblyName + "/Spring.Data.NHibernate/templateTests.xml");
|
||||
|
||||
dbProvider = ctx["DbProvider"] as IDbProvider;
|
||||
transactionManager = ctx["hibernateTransactionManager"] as IPlatformTransactionManager;
|
||||
CleanupDatabase(dbProvider.CreateConnection());
|
||||
}
|
||||
|
||||
private static void CleanupDatabase(IDbConnection conn)
|
||||
{
|
||||
conn.Open();
|
||||
using(conn)
|
||||
{
|
||||
ExecuteSql(conn, "delete credits");
|
||||
ExecuteSql(conn, "delete debits");
|
||||
ExecuteSql(conn, "delete TestObjects");
|
||||
ExecuteSql(conn, "insert TestObjects(Age,Name) Values(5, 'Gabriel')");
|
||||
}
|
||||
}
|
||||
|
||||
private static void ExecuteSql(IDbConnection conn, string sql)
|
||||
{
|
||||
IDbCommand cmd;
|
||||
cmd = conn.CreateCommand();
|
||||
cmd.CommandText = sql;
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ExceptionTranslator()
|
||||
{
|
||||
ISessionFactory sessionFactory = ctx["SessionFactory"] as ISessionFactory;
|
||||
HibernateTemplate template = new HibernateTemplate(sessionFactory);
|
||||
IAdoExceptionTranslator translator = template.AdoExceptionTranslator;
|
||||
Assert.IsNotNull(translator, "ADO.NET exception translator should not be null");
|
||||
|
||||
Assert.That(translator, Is.InstanceOf(typeof(ErrorCodeExceptionTranslator)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("what's the purpose of this test?")] // TODO: what's the purpose of this test?
|
||||
public void FallbackExceptionTranslator()
|
||||
{
|
||||
//ISessionFactory sessionFactory = ctx["SessionFactory"] as ISessionFactory;
|
||||
//HibernateTemplate template = new HibernateTemplate(sessionFactory);
|
||||
IAdoExceptionTranslator fallbackTranslator = new FallbackExceptionTranslator();
|
||||
fallbackTranslator.Translate("test", "sql", new Exception("foo"));
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("Just for demo purposes")]
|
||||
public void DemoDao()
|
||||
{
|
||||
|
||||
ITestObjectDao dao = (ITestObjectDao)ctx["testObjectDaoViaTxAttributes"];
|
||||
TestObject toGeorge = new TestObject();
|
||||
toGeorge.Name = "George";
|
||||
toGeorge.Age = 33;
|
||||
dao.Create(toGeorge);
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("Just for demo purposes")]
|
||||
public void SimpleDao()
|
||||
{
|
||||
ITestObjectDao dao = (ITestObjectDao)ctx["NHTestObjectDao"];
|
||||
Assert.IsNotNull(dao);
|
||||
TestObject to = dao.FindByName("Gabriel");
|
||||
Assert.IsNotNull(to);
|
||||
Assert.AreEqual("Gabriel", to.Name);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test simple data base operations using attributes for
|
||||
/// declarative transaction demarcation.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void DaoOperationsViaProxyFactoryWithTxAttributes()
|
||||
{
|
||||
|
||||
ITestObjectDao dao = (ITestObjectDao)ctx["testObjectDaoViaTxAttributes"];
|
||||
ExecuteDaoOperations(dao);
|
||||
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void DaoOperationsViaTransactionProxy()
|
||||
{
|
||||
|
||||
ITestObjectDao dao = (ITestObjectDao)ctx["testObjectDaoTransProxy"];
|
||||
ExecuteDaoOperations(dao);
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DaoOperationsWithRollback()
|
||||
{
|
||||
ITestObjectDao dao = (ITestObjectDao)ctx["testObjectDaoTransProxy"];
|
||||
try
|
||||
{
|
||||
ExecuteAndRollbackDaoOperations(dao);
|
||||
} catch (Exception e)
|
||||
{
|
||||
TestObject to = dao.FindByName("Bugs");
|
||||
Assert.IsNull(to);
|
||||
|
||||
//just to get rid of compiler warning...
|
||||
Assert.IsNotNull(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static void ExecuteAndRollbackDaoOperations(ITestObjectDao dao)
|
||||
{
|
||||
TestObject toBugs = new TestObject();
|
||||
toBugs.Name = "Bugs";
|
||||
toBugs.Age = 33;
|
||||
dao.CreateUpdateRollback(toBugs);
|
||||
|
||||
}
|
||||
private static void ExecuteDaoOperations(ITestObjectDao dao)
|
||||
{
|
||||
TestObject toGeorge = new TestObject();
|
||||
toGeorge.Name = "George";
|
||||
toGeorge.Age = 33;
|
||||
dao.Create(toGeorge);
|
||||
TestObject to = dao.FindByName("George");
|
||||
Assert.IsNotNull(to, "FindByName for George should not return null");
|
||||
Assert.AreEqual("George", to.Name);
|
||||
Assert.AreEqual(33, to.Age);
|
||||
|
||||
to.Age=34;
|
||||
dao.Update(to);
|
||||
|
||||
TestObject to2 = dao.FindByName("George");
|
||||
Assert.AreEqual(34, to2.Age);
|
||||
|
||||
dao.Delete(to);
|
||||
|
||||
TestObject to3 = dao.FindByName("George");
|
||||
Assert.IsNull(to3, "Should not have found TestObject with name George. TestObject = " + to.ToString() );
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void ExecuteTemplate()
|
||||
{
|
||||
ITestObjectDao dao = (ITestObjectDao)ctx["NHTestObjectDao"];
|
||||
TransactionTemplate tt = new TransactionTemplate(transactionManager);
|
||||
object result = tt.Execute(new SimpleTransactionCallback(dbProvider, dao));
|
||||
TestObject to = result as TestObject;
|
||||
Assert.IsNotNull(to,"FindByName for Gabriel should not return null");
|
||||
Assert.AreEqual("Gabriel", to.Name);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ExecuteTransactionManager()
|
||||
{
|
||||
DefaultTransactionDefinition def = new DefaultTransactionDefinition();
|
||||
def.PropagationBehavior = TransactionPropagation.Required;
|
||||
|
||||
ITransactionStatus status = transactionManager.GetTransaction(def);
|
||||
|
||||
ITestObjectDao dao = (ITestObjectDao)ctx["NHTestObjectDao"];
|
||||
TestObject to;
|
||||
try
|
||||
{
|
||||
to = dao.FindByName("Gabriel");
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
transactionManager.Rollback(status);
|
||||
throw;
|
||||
}
|
||||
transactionManager.Commit(status);
|
||||
Assert.IsNotNull(to,"FindByName for Gabriel should not return null");
|
||||
Assert.AreEqual("Gabriel", to.Name);
|
||||
}
|
||||
|
||||
private class SimpleTransactionCallback : ITransactionCallback
|
||||
{
|
||||
private IDbProvider dbProvider;
|
||||
private ITestObjectDao dao;
|
||||
|
||||
public SimpleTransactionCallback(IDbProvider dbp, ITestObjectDao dao)
|
||||
{
|
||||
dbProvider = dbp;
|
||||
this.dao = dao;
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets called by TransactionTemplate.Execute within a
|
||||
/// transaction context.
|
||||
/// </summary>
|
||||
/// <param name="status">The associated transaction status.</param>
|
||||
/// <returns>a result object or <c>null</c></returns>
|
||||
public object DoInTransaction(ITransactionStatus status)
|
||||
{
|
||||
return dao.FindByName("Gabriel");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,75 +1,75 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright © 2002-2011 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
|
||||
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
/// <summary>
|
||||
/// TODO:
|
||||
/// </summary>
|
||||
/// <author>Mark Pollack (.NET)</author>
|
||||
public class TestObject
|
||||
{
|
||||
#region Fields
|
||||
private int age;
|
||||
private string name;
|
||||
private int objectNumber;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor (s)
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TestObject"/> class.
|
||||
/// </summary>
|
||||
public TestObject()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public virtual int Age
|
||||
{
|
||||
get { return age; }
|
||||
set { age = value; }
|
||||
}
|
||||
|
||||
public virtual string Name
|
||||
{
|
||||
get { return name; }
|
||||
set { name = value; }
|
||||
}
|
||||
|
||||
public virtual int ObjectNumber
|
||||
{
|
||||
get { return objectNumber; }
|
||||
set { objectNumber = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright © 2002-2011 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
|
||||
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
/// <summary>
|
||||
/// TODO:
|
||||
/// </summary>
|
||||
/// <author>Mark Pollack (.NET)</author>
|
||||
public class TestObject
|
||||
{
|
||||
#region Fields
|
||||
private int age;
|
||||
private string name;
|
||||
private int objectNumber;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor (s)
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TestObject"/> class.
|
||||
/// </summary>
|
||||
public TestObject()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public virtual int Age
|
||||
{
|
||||
get { return age; }
|
||||
set { age = value; }
|
||||
}
|
||||
|
||||
public virtual string Name
|
||||
{
|
||||
get { return name; }
|
||||
set { name = value; }
|
||||
}
|
||||
|
||||
public virtual int ObjectNumber
|
||||
{
|
||||
get { return objectNumber; }
|
||||
set { objectNumber = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,20 @@
|
||||
|
||||
CREATE TABLE [Credits](
|
||||
[CreditID] [int] IDENTITY NOT NULL,
|
||||
[CreditAmount] [float] NOT NULL,
|
||||
CONSTRAINT [PK_CreditID] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[CreditID] ASC
|
||||
) ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
;
|
||||
|
||||
CREATE TABLE [Debits](
|
||||
[DebitID] [int] IDENTITY NOT NULL,
|
||||
[DebitAmount] [float] NOT NULL,
|
||||
CONSTRAINT [PK_DebitID] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[DebitID] ASC
|
||||
) ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
|
||||
CREATE TABLE [Credits](
|
||||
[CreditID] [int] IDENTITY NOT NULL,
|
||||
[CreditAmount] [float] NOT NULL,
|
||||
CONSTRAINT [PK_CreditID] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[CreditID] ASC
|
||||
) ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
;
|
||||
|
||||
CREATE TABLE [Debits](
|
||||
[DebitID] [int] IDENTITY NOT NULL,
|
||||
[DebitAmount] [float] NOT NULL,
|
||||
CONSTRAINT [PK_DebitID] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[DebitID] ASC
|
||||
) ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
;
|
||||
@@ -1,10 +1,10 @@
|
||||
|
||||
CREATE TABLE [TestObjects] (
|
||||
[TestObjectNo] int IDENTITY NOT NULL,
|
||||
[Age] int NOT NULL,
|
||||
[Name] nvarchar(1024),
|
||||
CONSTRAINT [TestObjectNo] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[TestObjectNo] ASC
|
||||
)
|
||||
|
||||
CREATE TABLE [TestObjects] (
|
||||
[TestObjectNo] int IDENTITY NOT NULL,
|
||||
[Age] int NOT NULL,
|
||||
[Name] nvarchar(1024),
|
||||
CONSTRAINT [TestObjectNo] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[TestObjectNo] ASC
|
||||
)
|
||||
);
|
||||
@@ -1,13 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netcoreapp2.1;net461</TargetFrameworks>
|
||||
<DefineConstants>$(DefineConstants);NH_5</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Aop\Spring.Aop.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Core\Spring.Core.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Data.NHibernate5\Spring.Data.NHibernate5.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Data\Spring.Data.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Testing.NUnit\Spring.Testing.NUnit.csproj" />
|
||||
<ProjectReference Include="..\Spring.Core.Tests\Spring.Core.Tests.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="log4net" Version="$(Log4NetVersion)" />
|
||||
@@ -20,109 +21,9 @@
|
||||
<Reference Include="System.Transactions" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\AccountController.cs">
|
||||
<Link>Data\NHibernate\AccountController.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\AccountCreditDao.cs">
|
||||
<Link>Data\NHibernate\AccountCreditDao.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\AccountDebitDao.cs">
|
||||
<Link>Data\NHibernate\AccountDebitDao.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\AccountManager.cs">
|
||||
<Link>Data\NHibernate\AccountManager.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\AuditDao.cs">
|
||||
<Link>Data\NHibernate\AuditDao.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Bytecode\AbstractInjectableUserTypeFixture.cs">
|
||||
<Link>Data\Bytecode\AbstractInjectableUserTypeFixture.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Bytecode\Foo.cs">
|
||||
<Link>Data\Bytecode\Foo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Bytecode\IDelimiter.cs">
|
||||
<Link>Data\Bytecode\IDelimiter.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Bytecode\InjectableStringUserType.cs">
|
||||
<Link>Data\Bytecode\InjectableStringUserType.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Bytecode\InjectableUserTypeFixture.cs">
|
||||
<Link>Data\Bytecode\InjectableUserTypeFixture.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Bytecode\Product.cs">
|
||||
<Link>Data\Bytecode\Product.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Credit.cs">
|
||||
<Link>Data\NHibernate\Credit.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\DbProviderTemplateTests.cs">
|
||||
<Link>Data\NHibernate\DbProviderTemplateTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Debit.cs">
|
||||
<Link>Data\NHibernate\Debit.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\HibernateTxScopeTransactionManagerTests.cs">
|
||||
<Link>Data\NHibernate\HibernateTxScopeTransactionManagerTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\IAccountController.cs">
|
||||
<Link>Data\NHibernate\IAccountController.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\IAccountCreditDao.cs">
|
||||
<Link>Data\NHibernate\IAccountCreditDao.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\IAccountDebitDao.cs">
|
||||
<Link>Data\NHibernate\IAccountDebitDao.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\IAccountManager.cs">
|
||||
<Link>Data\NHibernate\IAccountManager.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\IAuditDao.cs">
|
||||
<Link>Data\NHibernate\IAuditDao.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\ITestObjectDao.cs">
|
||||
<Link>Data\NHibernate\ITestObjectDao.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\MultipleDbTests.cs">
|
||||
<Link>Data\NHibernate\MultipleDbTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\NativeNHTestObjectDao.cs">
|
||||
<Link>Data\NHibernate\NativeNHTestObjectDao.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\NativeNHTests.cs">
|
||||
<Link>Data\NHibernate\NativeNHTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\NHDAOTests.cs">
|
||||
<Link>Data\NHibernate\NHDAOTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\NHTestObjectDao.cs">
|
||||
<Link>Data\NHibernate\NHTestObjectDao.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\SimpleTestDao.cs">
|
||||
<Link>Data\NHibernate\SimpleTestDao.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\TemplateTests.cs">
|
||||
<Link>Data\NHibernate\TemplateTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\TestObject.cs">
|
||||
<Link>Data\NHibernate\TestObject.cs</Link>
|
||||
</Compile>
|
||||
<None Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\creditdebit.sql">
|
||||
<Link>Data\NHibernate\creditdebit.sql</Link>
|
||||
</None>
|
||||
<Content Include="Data\**\*">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\HibernateTxScopeTransactionManagerTests.xml">
|
||||
<Link>Data\NHibernate\HibernateTxScopeTransactionManagerTests.xml</Link>
|
||||
</Content>
|
||||
<Content Include="Data\NHibernate\Bytecode\Foo.Spechbm.xml" />
|
||||
<EmbeddedResource Include="Data\NHibernate\*.xml" />
|
||||
<EmbeddedResource Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Controllers.xml">
|
||||
<Link>Data\NHibernate\Controllers.xml</Link>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Services.xml">
|
||||
<Link>Data\NHibernate\Services.xml</Link>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -15,8 +15,8 @@
|
||||
<spring>
|
||||
<context>
|
||||
<resource uri="config://spring/objects"/>
|
||||
<resource uri="assembly://Spring.Data.NHibernate4.NestedTxSuspension.Integration.Tests/Spring.Data.NHibernate4.NestedTxSuspension.Integration.Tests/Spring.Configuration.xml"/>
|
||||
<resource uri="assembly://Spring.Data.NHibernate4.NestedTxSuspension.Integration.Tests/Spring.Data.NHibernate4.NestedTxSuspension.Integration.Tests/Spring.NHibernate.xml"/>
|
||||
<resource uri="assembly://Spring.Data.NHibernate5.NestedTxSuspension.Integration.Tests/Spring.Data.NHibernate5.NestedTxSuspension.Integration.Tests/Spring.Configuration.xml"/>
|
||||
<resource uri="assembly://Spring.Data.NHibernate5.NestedTxSuspension.Integration.Tests/Spring.Data.NHibernate5.NestedTxSuspension.Integration.Tests/Spring.NHibernate.xml"/>
|
||||
</context>
|
||||
<parsers>
|
||||
<parser type="Spring.Data.Config.DatabaseNamespaceParser, Spring.Data"/>
|
||||
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace Spring.Data.NHibernate4.NestedTxSuspension.Integration.Tests
|
||||
namespace Spring.Data.NHibernate5.NestedTxSuspension.Integration.Tests
|
||||
{
|
||||
public class Container : IContainer
|
||||
{
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
using Spring.Testing.NUnit;
|
||||
|
||||
namespace Spring.Data.NHibernate4.NestedTxSuspension.Integration.Tests
|
||||
namespace Spring.Data.NHibernate5.NestedTxSuspension.Integration.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class HibernateTxScopeTransactionManagerNestedTransactionSuspensionTests : AbstractTransactionalSpringContextTests
|
||||
@@ -21,9 +21,9 @@ namespace Spring.Data.NHibernate4.NestedTxSuspension.Integration.Tests
|
||||
return new[]
|
||||
{
|
||||
"config://spring/objects",
|
||||
"assembly://Spring.Data.NHibernate4.NestedTxSuspension.Integration.Tests/Spring.Data.NHibernate4.NestedTxSuspension.Integration.Tests/Spring.Configuration.xml",
|
||||
"assembly://Spring.Data.NHibernate4.NestedTxSuspension.Integration.Tests/Spring.Data.NHibernate4.NestedTxSuspension.Integration.Tests/Spring.NHibernate.xml",
|
||||
"assembly://Spring.Data.NHibernate4.NestedTxSuspension.Integration.Tests/Spring.Data.NHibernate4.NestedTxSuspension.Integration.Tests/Spring.HibernateTxScopeTransactionManager.xml"
|
||||
"assembly://Spring.Data.NHibernate5.NestedTxSuspension.Integration.Tests/Spring.Data.NHibernate5.NestedTxSuspension.Integration.Tests/Spring.Configuration.xml",
|
||||
"assembly://Spring.Data.NHibernate5.NestedTxSuspension.Integration.Tests/Spring.Data.NHibernate5.NestedTxSuspension.Integration.Tests/Spring.NHibernate.xml",
|
||||
"assembly://Spring.Data.NHibernate5.NestedTxSuspension.Integration.Tests/Spring.Data.NHibernate5.NestedTxSuspension.Integration.Tests/Spring.HibernateTxScopeTransactionManager.xml"
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace Spring.Data.NHibernate4.NestedTxSuspension.Integration.Tests
|
||||
namespace Spring.Data.NHibernate5.NestedTxSuspension.Integration.Tests
|
||||
{
|
||||
public interface IContainer
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Spring.Data.NHibernate4.NestedTxSuspension.Integration.Tests
|
||||
namespace Spring.Data.NHibernate5.NestedTxSuspension.Integration.Tests
|
||||
{
|
||||
public interface IService1
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Spring.Data.NHibernate4.NestedTxSuspension.Integration.Tests
|
||||
namespace Spring.Data.NHibernate5.NestedTxSuspension.Integration.Tests
|
||||
{
|
||||
public interface IService2
|
||||
{
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-lazy="true" assembly="Spring.Data.NHibernate4.NestedTxSuspension.Integration.Tests" namespace="Spring.Data.NHibernate4.NestedTxSuspension.Integration.Tests">
|
||||
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-lazy="true" assembly="Spring.Data.NHibernate5.NestedTxSuspension.Integration.Tests" namespace="Spring.Data.NHibernate5.NestedTxSuspension.Integration.Tests">
|
||||
|
||||
<class name="Container" proxy="IContainer">
|
||||
<id name="Id">
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyTitle("Spring.Data.NHibernate4.NestedTxSuspension.Integration.Tests")]
|
||||
[assembly: AssemblyTitle("Spring.Data.NHibernate5.NestedTxSuspension.Integration.Tests")]
|
||||
[assembly: AssemblyDescription("Integration tests for HibernteTxScopeTransactionManager suspension of transactions")]
|
||||
@@ -1,7 +1,7 @@
|
||||
using Spring.Data.NHibernate.Generic;
|
||||
using Spring.Transaction;
|
||||
|
||||
namespace Spring.Data.NHibernate4.NestedTxSuspension.Integration.Tests
|
||||
namespace Spring.Data.NHibernate5.NestedTxSuspension.Integration.Tests
|
||||
{
|
||||
[Transaction.Interceptor.Transaction(TransactionPropagation.Supports, ReadOnly = true)]
|
||||
public class Service1 : IService1
|
||||
@@ -1,7 +1,7 @@
|
||||
using Spring.Data.NHibernate.Generic;
|
||||
using Spring.Transaction;
|
||||
|
||||
namespace Spring.Data.NHibernate4.NestedTxSuspension.Integration.Tests
|
||||
namespace Spring.Data.NHibernate5.NestedTxSuspension.Integration.Tests
|
||||
{
|
||||
[Transaction.Interceptor.Transaction(TransactionPropagation.Supports, ReadOnly = true)]
|
||||
public class Service2 : IService2
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<db:provider id="ActiveDbProvider" connectionString="${conn.active}" provider="${provider.active}" />
|
||||
|
||||
<object id="Spring.Data.NHibernate.Generic.HibernateTemplate" type="Spring.Data.NHibernate.Generic.HibernateTemplate, Spring.Data.NHibernate4">
|
||||
<object id="Spring.Data.NHibernate.Generic.HibernateTemplate" type="Spring.Data.NHibernate.Generic.HibernateTemplate, Spring.Data.NHibernate5">
|
||||
<property name="SessionFactory" ref="Spring.Data.NHibernate.LocalSessionFactoryObject" />
|
||||
<property name="TemplateFlushMode" value="Auto" />
|
||||
<property name="CacheQueries" value="true" />
|
||||
@@ -26,11 +26,11 @@
|
||||
</property>
|
||||
</object>
|
||||
|
||||
<object id="IService1" type="Spring.Data.NHibernate4.NestedTxSuspension.Integration.Tests.Service1, Spring.Data.NHibernate4.NestedTxSuspension.Integration.Tests">
|
||||
<object id="IService1" type="Spring.Data.NHibernate5.NestedTxSuspension.Integration.Tests.Service1, Spring.Data.NHibernate5.NestedTxSuspension.Integration.Tests">
|
||||
<property name="HibernateTemplate" ref="Spring.Data.NHibernate.Generic.HibernateTemplate" />
|
||||
</object>
|
||||
|
||||
<object id="IService2" type="Spring.Data.NHibernate4.NestedTxSuspension.Integration.Tests.Service2, Spring.Data.NHibernate4.NestedTxSuspension.Integration.Tests">
|
||||
<object id="IService2" type="Spring.Data.NHibernate5.NestedTxSuspension.Integration.Tests.Service2, Spring.Data.NHibernate5.NestedTxSuspension.Integration.Tests">
|
||||
<property name="HibernateTemplate" ref="Spring.Data.NHibernate.Generic.HibernateTemplate" />
|
||||
</object>
|
||||
</objects>
|
||||
@@ -1,12 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net452</TargetFramework>
|
||||
<RootNamespace>Spring.Data.NHibernate4.NestedTxSuspension.Integration.Tests</RootNamespace>
|
||||
<TargetFramework>net461</TargetFramework>
|
||||
<RootNamespace>Spring.Data.NHibernate5.NestedTxSuspension.Integration.Tests</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Aop\Spring.Aop.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Core\Spring.Core.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Data.NHibernate4\Spring.Data.NHibernate4.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Data.NHibernate5\Spring.Data.NHibernate5.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Data\Spring.Data.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Testing.NUnit\Spring.Testing.NUnit.csproj" />
|
||||
</ItemGroup>
|
||||
@@ -2,7 +2,7 @@
|
||||
<objects xmlns='http://www.springframework.net' xmlns:db="http://www.springframework.net/database" xmlns:tx="http://www.springframework.net/tx" xmlns:aop="http://www.springframework.net/aop">
|
||||
|
||||
|
||||
<object id="Spring.Transaction.IPlatformTransactionManager" type="Spring.Data.NHibernate.HibernateTxScopeTransactionManager, Spring.Data.NHibernate4">
|
||||
<object id="Spring.Transaction.IPlatformTransactionManager" type="Spring.Data.NHibernate.HibernateTxScopeTransactionManager, Spring.Data.NHibernate5">
|
||||
<property name="DbProvider" ref="ActiveDbProvider"/>
|
||||
<property name="SessionFactory" ref="Spring.Data.NHibernate.LocalSessionFactoryObject"/>
|
||||
</object>
|
||||
@@ -2,7 +2,7 @@
|
||||
<objects xmlns="http://www.springframework.net" xmlns:db="http://www.springframework.net/database">
|
||||
<description>Dependency Injection for NHibernate Session</description>
|
||||
|
||||
<object id="Spring.Data.NHibernate.LocalSessionFactoryObject" type="Spring.Data.NHibernate.LocalSessionFactoryObject, Spring.Data.NHibernate4">
|
||||
<object id="Spring.Data.NHibernate.LocalSessionFactoryObject" type="Spring.Data.NHibernate.LocalSessionFactoryObject, Spring.Data.NHibernate5">
|
||||
<property name="DbProvider" ref="ActiveDbProvider"/>
|
||||
|
||||
<property name="HibernateProperties">
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
<property name="MappingResources">
|
||||
<list>
|
||||
<value>assembly://Spring.Data.NHibernate4.NestedTxSuspension.Integration.Tests/Spring.Data.NHibernate4.NestedTxSuspension.Integration.Tests/Mappings.hbm.xml</value>
|
||||
<value>assembly://Spring.Data.NHibernate5.NestedTxSuspension.Integration.Tests/Spring.Data.NHibernate5.NestedTxSuspension.Integration.Tests/Mappings.hbm.xml</value>
|
||||
</list>
|
||||
</property>
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright <20> 2002-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
#region Imports
|
||||
|
||||
using NUnit.Framework;
|
||||
using Spring.Aop.Framework;
|
||||
using Spring.Context;
|
||||
using Spring.Context.Support;
|
||||
using Spring.Transaction;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Spring.Data.NHibernate.Config
|
||||
{
|
||||
/// <summary>
|
||||
/// This class contains tests for
|
||||
/// </summary>
|
||||
/// <author>Mark Pollack</author>
|
||||
[TestFixture]
|
||||
public class AopConfiguration
|
||||
{
|
||||
private IApplicationContext ctx;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
string aopConfigPath =
|
||||
string.Format(
|
||||
"assembly://{0}/Spring.Data.NHibernate.Config/AopConfiguration.xml"
|
||||
, this.GetType().Assembly.GetName().Name);
|
||||
ctx = new XmlApplicationContext(aopConfigPath);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ProxyDataAccessAndServiceLayer()
|
||||
{
|
||||
Assert.IsFalse(AopUtils.IsAopProxy( ctx["DbProvider"] ));
|
||||
Assert.IsFalse(AopUtils.IsAopProxy( ctx["SessionFactory"] ));
|
||||
Assert.IsFalse(AopUtils.IsAopProxy(ctx["hibernateTransactionManager"]));
|
||||
Assert.IsFalse(AopUtils.IsAopProxy(ctx["transactionManager"]));
|
||||
//Assert.IsTrue(AopUtils.IsAopProxy(ctx["testObjectDaoTransProxy"]));
|
||||
Assert.IsTrue(AopUtils.IsAopProxy(ctx["TestObjectDao"]));
|
||||
Assert.IsTrue(AopUtils.IsAopProxy(ctx["SimpleService"]));
|
||||
|
||||
CallCountingTransactionManager ccm = ctx["transactionManager"] as CallCountingTransactionManager;
|
||||
Assert.IsNotNull(ccm);
|
||||
Assert.AreEqual(0, ccm.begun);
|
||||
Assert.AreEqual(0, ccm.commits);
|
||||
|
||||
LoggingAroundAdvice caa = ctx["loggingAroundAdvice"] as LoggingAroundAdvice;
|
||||
Assert.IsNotNull(caa);
|
||||
Assert.AreEqual(0, caa.numInvoked);
|
||||
|
||||
ISimpleService simpleService = ctx["SimpleService"] as ISimpleService;
|
||||
Assert.IsNotNull(simpleService);
|
||||
simpleService.DoWork(new TestObject());
|
||||
Assert.AreEqual(1, ccm.begun);
|
||||
Assert.AreEqual(1, ccm.commits);
|
||||
Assert.AreEqual(1, caa.numInvoked);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
using NUnit.Framework;
|
||||
|
||||
using NhCfg = NHibernate.Cfg;
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Spring.Data.Common;
|
||||
|
||||
using NHibernate.Dialect;
|
||||
|
||||
using Spring.Context.Support;
|
||||
|
||||
using NHibernate.Connection;
|
||||
using NHibernate.Driver;
|
||||
|
||||
namespace Spring.Data.NHibernate
|
||||
{
|
||||
[TestFixture]
|
||||
public class DelegatingLocalSessionFactoryObjectTests
|
||||
{
|
||||
[Test]
|
||||
public void CanSetConfigurationAndProperties()
|
||||
{
|
||||
IDbProvider dbProvider = DbProviderFactory.GetDbProvider("System.Data.SqlClient");
|
||||
dbProvider.ConnectionString = "Data Source=(local);Database=Spring;Trusted_Connection=false";
|
||||
DelegatingLocalSessionFactoryObject lsfo = new DelegatingLocalSessionFactoryObject();
|
||||
lsfo.DbProvider = dbProvider;
|
||||
lsfo.ApplicationContext = new StaticApplicationContext();
|
||||
|
||||
IDictionary<string, string> properties = new Dictionary<string, string>();
|
||||
properties.Add(NhCfg.Environment.Dialect, typeof(MsSql2000Dialect).AssemblyQualifiedName);
|
||||
properties.Add(NhCfg.Environment.ConnectionDriver, typeof(SqlClientDriver).AssemblyQualifiedName);
|
||||
properties.Add(NhCfg.Environment.ConnectionProvider, typeof(DriverConnectionProvider).AssemblyQualifiedName);
|
||||
|
||||
properties.Add(NhCfg.Environment.Hbm2ddlKeyWords, "none");
|
||||
|
||||
lsfo.HibernateProperties = properties;
|
||||
lsfo.AfterPropertiesSet();
|
||||
|
||||
Assert.IsNotNull(lsfo.Configuration);
|
||||
Assert.AreEqual(lsfo.Configuration.Properties[NhCfg.Environment.ConnectionProvider], typeof(DriverConnectionProvider).AssemblyQualifiedName);
|
||||
Assert.AreEqual(lsfo.Configuration.Properties[NhCfg.Environment.ConnectionDriver], typeof(SqlClientDriver).AssemblyQualifiedName);
|
||||
Assert.AreEqual(lsfo.Configuration.Properties[NhCfg.Environment.Dialect], typeof(MsSql2000Dialect).AssemblyQualifiedName);
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user