automated NH21 integration tests up & running

This commit is contained in:
eeichinger
2009-08-02 22:25:00 +00:00
parent 6fbf135530
commit 442d943ebe
18 changed files with 1883 additions and 352 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@@ -0,0 +1,143 @@
<?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>
<!-- The assembly binding for FirebirdClient ADO.NET 2.0 DataProvider -->
<!-- -->
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<qualifyAssembly partialName="FirebirdSql.Data.FirebirdClient" fullName="FirebirdSql.Data.FirebirdClient, Version=2.1.0.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c" />
</assemblyBinding>
<!-- -->
</runtime>
<!--
hibernate-configuration section
You don't need to change this section for your own use.
You can write your own hibernate.cfg.xml to override all session-factory configuration.
Templates are available in NHibernate.Config.Templates folder.
-->
<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=(local);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">Spring.Data.NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property>
</session-factory>
</hibernate-configuration>
<!-- This section contains the log4net configuration settings -->
<log4net debug="false">
<!-- 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>
<appender name="rollingFile"
type="log4net.Appender.RollingFileAppender,log4net" >
<param name="File"
value="log.txt" />
<param name="AppendToFile"
value="false" />
<param name="RollingStyle"
value="Date" />
<param name="DatePattern"
value="yyyy.MM.dd" />
<param name="StaticLogFileName"
value="true" />
<layout type="log4net.Layout.PatternLayout,log4net">
<param name="ConversionPattern"
value="%d [%t] %-5p %c - %m%n" />
</layout>
</appender>
<!-- Setup the root category, add the appenders and set the default priority -->
<root>
<priority value="WARN" />
<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>

View File

@@ -1,7 +1,7 @@
#region License
#region License
/*
* Copyright <20> 2002-2005 the original author or authors.
* Copyright <20> 2002-2009 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,244 +14,243 @@
* 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.Globalization;
using System.IO;
using System.Reflection;
using Common.Logging;
#endregion
namespace Spring.Core.IO
{
/// <summary>
/// An <see cref="Spring.Core.IO.IResource"/> implementation for
/// resources stored within assemblies.
/// </summary>
/// <remarks>
/// <p>
/// This implementation expects any resource name passed to the
/// constructor to adhere to the following format:
/// </p>
/// <p>
/// assembly://<i>assemblyName</i>/<i>namespace</i>/<i>resourceName</i>
/// </p>
/// </remarks>
/// <author>Aleksandar Seovic (.NET)</author>
/// <author>Federico Spinazzi (.NET)</author>
public class AssemblyResource : AbstractResource
{
#region Fields
private Assembly _assembly;
private string[] _resources;
private string _resourceName;
private string _fullResourceName;
private string _resourceNamespace;
private string _resourceAssemblyName;
private static readonly ILog log = LogManager.GetLogger(typeof(AssemblyResource));
#endregion
#region Constructors
/// <summary>
/// Creates a new instance of the
/// <see cref="Spring.Core.IO.AssemblyResource"/> class.
/// </summary>
/// <param name="resourceName">
/// The name of the assembly resource.
/// </param>
/// <exception cref="System.UriFormatException">
/// If the supplied <paramref name="resourceName"/> did not conform
/// to the expected format.
/// </exception>
/// <exception cref="System.IO.FileLoadException">
/// If the assembly specified in the supplied
/// <paramref name="resourceName"/> was loaded twice with two
/// different evidences.
/// </exception>
/// <exception cref="System.IO.FileNotFoundException">
/// If the assembly specified in the supplied
/// <paramref name="resourceName"/> could not be found.
/// </exception>
/// <exception cref="System.Security.SecurityException">
/// If the caller does not have the required permission to load
/// the assembly specified in the supplied
/// <paramref name="resourceName"/>.
/// </exception>
/// <see cref="System.Reflection.Assembly.LoadWithPartialName(string)"/>
public AssemblyResource(string resourceName) : base(resourceName)
{
string[] info = GetResourceNameWithoutProtocol(resourceName).Split('/');
if (info.Length != 3)
{
throw new UriFormatException(
"Invalid resource name. Name has to be in " +
"'assembly:<assemblyName>/<namespace>/<resourceName>' format.");
}
#if NET_2_0
this._assembly = Assembly.Load(info[0]);
*/
#endregion
#region Imports
using System;
using System.Globalization;
using System.IO;
using System.Reflection;
using Common.Logging;
#endregion
namespace Spring.Core.IO
{
/// <summary>
/// An <see cref="Spring.Core.IO.IResource"/> implementation for
/// resources stored within assemblies.
/// </summary>
/// <remarks>
/// <p>
/// This implementation expects any resource name passed to the
/// constructor to adhere to the following format:
/// </p>
/// <p>
/// assembly://<i>assemblyName</i>/<i>namespace</i>/<i>resourceName</i>
/// </p>
/// </remarks>
/// <author>Aleksandar Seovic (.NET)</author>
/// <author>Federico Spinazzi (.NET)</author>
public class AssemblyResource : AbstractResource
{
#region Fields
private Assembly _assembly;
private string[] _resources;
private string _resourceName;
private string _fullResourceName;
private string _resourceNamespace;
private string _resourceAssemblyName;
private static readonly ILog log = LogManager.GetLogger(typeof(AssemblyResource));
#endregion
#region Constructors
/// <summary>
/// Creates a new instance of the
/// <see cref="Spring.Core.IO.AssemblyResource"/> class.
/// </summary>
/// <param name="resourceName">
/// The name of the assembly resource.
/// </param>
/// <exception cref="System.UriFormatException">
/// If the supplied <paramref name="resourceName"/> did not conform
/// to the expected format.
/// </exception>
/// <exception cref="System.IO.FileLoadException">
/// If the assembly specified in the supplied
/// <paramref name="resourceName"/> was loaded twice with two
/// different evidences.
/// </exception>
/// <exception cref="System.IO.FileNotFoundException">
/// If the assembly specified in the supplied
/// <paramref name="resourceName"/> could not be found.
/// </exception>
/// <exception cref="System.Security.SecurityException">
/// If the caller does not have the required permission to load
/// the assembly specified in the supplied
/// <paramref name="resourceName"/>.
/// </exception>
/// <see cref="System.Reflection.Assembly.LoadWithPartialName(string)"/>
public AssemblyResource(string resourceName)
: base(resourceName)
{
string[] info = GetResourceNameWithoutProtocol(resourceName).Split('/');
if (info.Length != 3)
{
throw new UriFormatException(string.Format("Invalid resource name. Name has to be in 'assembly:<assemblyName>/<namespace>/<resourceName>' format:{0}", resourceName));
}
#if NET_2_0
this._assembly = Assembly.Load(info[0]);
#else
this._assembly = Assembly.LoadWithPartialName(info[0]);
#endif
if (this._assembly == null)
{
throw new FileNotFoundException("Unable to load assembly [" + info[0] + "]");
}
this._fullResourceName = resourceName;
this._resourceAssemblyName = info[0];
this._resourceNamespace = info[1];
this._resourceName = String.Format("{0}.{1}", info[1], info[2]);
}
#endregion
#region Properties
/// <summary>
/// Return an <see cref="System.IO.Stream"/> for this resource.
/// </summary>
/// <value>
/// An <see cref="System.IO.Stream"/>.
/// </value>
/// <exception cref="System.IO.IOException">
/// If the stream could not be opened.
/// </exception>
/// <exception cref="System.Security.SecurityException">
/// If the caller does not have the required permission to load
/// the underlying assembly's manifest.
/// </exception>
/// <seealso cref="Spring.Core.IO.IInputStreamSource"/>
/// <see cref="System.Reflection.Assembly.GetManifestResourceStream(string)"/>
public override Stream InputStream
{
get
{
Stream stream = _assembly.GetManifestResourceStream(_resourceName);
if (stream == null)
{
log.Error("Could not load resource with name = [" + _resourceName +
"] from assembly + " + _assembly);
log.Error("URI specified = [" + this._fullResourceName + "] Spring.NET URI syntax is 'assembly://assemblyName/namespace/resourceName'.");
log.Error("Resource name often has the default namespace prefixed, e.g. 'assembly://MyAssembly/MyNamespace/MyNamespace.MyResource.txt'.");
}
return stream;
}
}
/// <summary>
/// Does the embedded resource specified in the value passed to the
/// constructor exist?
/// </summary>
/// <value>
/// <see langword="true"/> if this resource actually exists in physical
/// form (for example on a filesystem).
/// </value>
/// <seealso cref="Spring.Core.IO.IResource.Exists"/>
/// <seealso cref="Spring.Core.IO.IResource.File"/>
/// <see cref="System.Reflection.Assembly.GetManifestResourceNames()"/>
public override bool Exists
{
get
{
if (_resources == null)
{
_resources = _assembly.GetManifestResourceNames();
Array.Sort(_resources);
}
return (Array.BinarySearch(_resources, _resourceName) >= 0);
}
}
/// <summary>
/// Does this <see cref="Spring.Core.IO.IResource"/> support relative
/// resource retrieval?
/// </summary>
/// <remarks>
/// <p>
/// This implementation does support relative resource retrieval, and
/// so will always return <see langword="true"/>.
/// </p>
/// </remarks>
/// <value>
/// <see langword="true"/> if this
/// <see cref="Spring.Core.IO.IResource"/> supports relative resource
/// retrieval.
/// </value>
/// <seealso cref="Spring.Core.IO.AbstractResource.SupportsRelativeResources"/>
protected override bool SupportsRelativeResources
{
get { return true; }
}
/// <summary>
/// Gets the root location of the resource (the assembly name in this
/// case).
/// </summary>
/// <value>
/// The root location of the resource.
/// </value>
/// <seealso cref="Spring.Core.IO.AbstractResource.RootLocation"/>
protected override string RootLocation
{
get { return _resourceAssemblyName; }
}
/// <summary>
/// Gets the current path of the resource (the namespace in which the
/// target resource was embedded in this case).
/// </summary>
/// <value>
/// The current path of the resource.
/// </value>
/// <seealso cref="Spring.Core.IO.AbstractResource.ResourcePath"/>
protected override string ResourcePath
{
get { return _resourceNamespace; }
}
/// <summary>
/// Gets those characters that are valid path separators for the
/// resource type.
/// </summary>
/// <value>
/// Those characters that are valid path separators for the resource
/// type.
/// </value>
/// <seealso cref="Spring.Core.IO.AbstractResource.PathSeparatorChars"/>
protected override char[] PathSeparatorChars
{
get { return new char[] {'.'}; }
}
/// <summary>
/// Returns a description for this resource.
/// </summary>
/// <value>
/// A description for this resource.
/// </value>
/// <seealso cref="Spring.Core.IO.IResource.Description"/>
public override string Description
{
get
{
return string.Format(
CultureInfo.InvariantCulture,
"assembly [{0}], resource [{1}]", _assembly.FullName, _resourceName);
}
}
#if NET_2_0
/// <summary>
/// Returns the <see cref="System.Uri"/> handle for this resource.
/// </summary>
#endif
if (this._assembly == null)
{
throw new FileNotFoundException("Unable to load assembly [" + info[0] + "]");
}
this._fullResourceName = resourceName;
this._resourceAssemblyName = info[0];
this._resourceNamespace = info[1];
this._resourceName = String.Format("{0}.{1}", info[1], info[2]);
}
#endregion
#region Properties
/// <summary>
/// Return an <see cref="System.IO.Stream"/> for this resource.
/// </summary>
/// <value>
/// An <see cref="System.IO.Stream"/>.
/// </value>
/// <exception cref="System.IO.IOException">
/// If the stream could not be opened.
/// </exception>
/// <exception cref="System.Security.SecurityException">
/// If the caller does not have the required permission to load
/// the underlying assembly's manifest.
/// </exception>
/// <seealso cref="Spring.Core.IO.IInputStreamSource"/>
/// <see cref="System.Reflection.Assembly.GetManifestResourceStream(string)"/>
public override Stream InputStream
{
get
{
Stream stream = _assembly.GetManifestResourceStream(_resourceName);
if (stream == null)
{
log.Error("Could not load resource with name = [" + _resourceName +
"] from assembly + " + _assembly);
log.Error("URI specified = [" + this._fullResourceName + "] Spring.NET URI syntax is 'assembly://assemblyName/namespace/resourceName'.");
log.Error("Resource name often has the default namespace prefixed, e.g. 'assembly://MyAssembly/MyNamespace/MyNamespace.MyResource.txt'.");
}
return stream;
}
}
/// <summary>
/// Does the embedded resource specified in the value passed to the
/// constructor exist?
/// </summary>
/// <value>
/// <see langword="true"/> if this resource actually exists in physical
/// form (for example on a filesystem).
/// </value>
/// <seealso cref="Spring.Core.IO.IResource.Exists"/>
/// <seealso cref="Spring.Core.IO.IResource.File"/>
/// <see cref="System.Reflection.Assembly.GetManifestResourceNames()"/>
public override bool Exists
{
get
{
if (_resources == null)
{
_resources = _assembly.GetManifestResourceNames();
Array.Sort(_resources);
}
return (Array.BinarySearch(_resources, _resourceName) >= 0);
}
}
/// <summary>
/// Does this <see cref="Spring.Core.IO.IResource"/> support relative
/// resource retrieval?
/// </summary>
/// <remarks>
/// <p>
/// This implementation does support relative resource retrieval, and
/// so will always return <see langword="true"/>.
/// </p>
/// </remarks>
/// <value>
/// <see langword="true"/> if this
/// <see cref="Spring.Core.IO.IResource"/> supports relative resource
/// retrieval.
/// </value>
/// <seealso cref="Spring.Core.IO.AbstractResource.SupportsRelativeResources"/>
protected override bool SupportsRelativeResources
{
get { return true; }
}
/// <summary>
/// Gets the root location of the resource (the assembly name in this
/// case).
/// </summary>
/// <value>
/// The root location of the resource.
/// </value>
/// <seealso cref="Spring.Core.IO.AbstractResource.RootLocation"/>
protected override string RootLocation
{
get { return _resourceAssemblyName; }
}
/// <summary>
/// Gets the current path of the resource (the namespace in which the
/// target resource was embedded in this case).
/// </summary>
/// <value>
/// The current path of the resource.
/// </value>
/// <seealso cref="Spring.Core.IO.AbstractResource.ResourcePath"/>
protected override string ResourcePath
{
get { return _resourceNamespace; }
}
/// <summary>
/// Gets those characters that are valid path separators for the
/// resource type.
/// </summary>
/// <value>
/// Those characters that are valid path separators for the resource
/// type.
/// </value>
/// <seealso cref="Spring.Core.IO.AbstractResource.PathSeparatorChars"/>
protected override char[] PathSeparatorChars
{
get { return new char[] { '.' }; }
}
/// <summary>
/// Returns a description for this resource.
/// </summary>
/// <value>
/// A description for this resource.
/// </value>
/// <seealso cref="Spring.Core.IO.IResource.Description"/>
public override string Description
{
get
{
return string.Format(
CultureInfo.InvariantCulture,
"assembly [{0}], resource [{1}]", _assembly.FullName, _resourceName);
}
}
#if NET_2_0
/// <summary>
/// Returns the <see cref="System.Uri"/> handle for this resource.
/// </summary>
/// <seealso cref="Spring.Core.IO.IResource.Uri"/>
public override Uri Uri
{
@@ -259,26 +258,26 @@ namespace Spring.Core.IO
{
return new Uri(_fullResourceName);
}
}
#endif
#endregion
/// <summary>
/// Does the supplied <paramref name="resourceName"/> relative ?
/// </summary>
/// <param name="resourceName">
/// The name of the resource to test.
/// </param>
/// <returns>
/// <see langword="true"/> if resource name is relative;
/// otherwise <see langword="false"/>.
/// </returns>
protected override bool IsRelativeResource(string resourceName)
{
return (resourceName.StartsWith("./") ||
resourceName.StartsWith("/") ||
resourceName.StartsWith("../") ||
resourceName.Split('/').Length != 3);
}
}
}
#endif
#endregion
/// <summary>
/// Does the supplied <paramref name="resourceName"/> relative ?
/// </summary>
/// <param name="resourceName">
/// The name of the resource to test.
/// </param>
/// <returns>
/// <see langword="true"/> if resource name is relative;
/// otherwise <see langword="false"/>.
/// </returns>
protected override bool IsRelativeResource(string resourceName)
{
return (resourceName.StartsWith("./") ||
resourceName.StartsWith("/") ||
resourceName.StartsWith("../") ||
resourceName.Split('/').Length != 3);
}
}
}

View File

@@ -95,11 +95,19 @@ namespace Spring.Testing.Ado
/// <summary>
/// Execute the given script
/// </summary>
public static void ExecuteSqlScript(AdoTemplate adoTemplate, string script, params Regex[] blockDelimiter)
public static void ExecuteSqlScript(IAdoOperations adoTemplate, string script, params Regex[] blockDelimiter)
{
ExecuteSqlScriptInternal(adoTemplate, new EncodedResource(new StringResource(script)), false, blockDelimiter);
}
/// <summary>
/// Execute the given script
/// </summary>
public static void ExecuteSqlScript(IAdoOperations adoTemplate, string script, bool continueOnError, params Regex[] blockDelimiter)
{
ExecuteSqlScriptInternal(adoTemplate, new EncodedResource(new StringResource(script)), continueOnError, blockDelimiter);
}
/// <summary>
/// Execute the given script
/// </summary>
@@ -108,6 +116,14 @@ namespace Spring.Testing.Ado
ExecuteSqlScriptInternal(adoTemplate, new EncodedResource(resourceLoader.GetResource(scriptResourcePath)), continueOnError, blockDelimiter);
}
/// <summary>
/// Execute the given script
/// </summary>
public static void ExecuteSqlScript(IAdoOperations adoTemplate, IResource resource, params Regex[] blockDelimiter)
{
ExecuteSqlScriptInternal(adoTemplate, new EncodedResource(resource), false, blockDelimiter);
}
/// <summary>
/// Execute the given script
/// </summary>

View File

@@ -189,7 +189,18 @@ namespace Spring
/// <see cref="Assembly.GetManifestResourceStream(Type,string)"/>
public static string GetAssemblyResourceUri(Type hint, string name)
{
return "assembly://" + hint.Assembly.FullName.Split(',')[0].Trim() + "/" + hint.Namespace + "/" + name;
return "assembly://" + hint.Assembly.FullName.Split(',')[0].Trim() + "/" + hint.Namespace + ((name.IndexOf('/')>-1)?".":"/") + name;
}
/// <summary>
/// returns an "assembly://" uri for the specified manifest resource, scoped by the namespace of the specified instance's type.
/// ("assembly://hint.assemblyname_without_version/hint.Namespace/name")
/// </summary>
/// <see cref="Assembly.GetManifestResourceStream(Type,string)"/>
public static string GetAssemblyResourceUri(object hint, string name)
{
Type hintType = hint.GetType();
return GetAssemblyResourceUri(hintType, name);
}
}
}

View File

@@ -7,6 +7,7 @@ CREATE TABLE [Credits](
[CreditID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
;
CREATE TABLE [Debits](
[DebitID] [int] IDENTITY NOT NULL,
@@ -15,4 +16,5 @@ CREATE TABLE [Debits](
(
[DebitID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
) ON [PRIMARY]
;

View File

@@ -7,4 +7,4 @@ CREATE TABLE [TestObjects] (
(
[TestObjectNo] ASC
)
)
);

View File

@@ -1,7 +1,7 @@
#region License
/*
* Copyright <20> 2002-2007 the original author or authors.
* Copyright <20> 2002-2009 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,24 +18,20 @@
#endregion
#region Imports
using System.Collections;
using System.IO;
using NHibernate;
#if NH_2_1
using Spring.Data.NHibernate.Bytecode;
#endif
using NHibernate.Cfg;
using NHibernate.Connection;
using NHibernate.Dialect;
using NHibernate.Driver;
using NUnit.Framework;
using Spring.Data.Common;
#if NH_2_1
using Spring.Data.NHibernate.Bytecode;
#endif
#endregion
using NUnit.Framework;
namespace Spring.Data.NHibernate
{

View File

@@ -1,5 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyTitle("Spring.Data.NHibernate21 Integration Tests")]
[assembly: AssemblyDescription("Integration tests for Spring.Data.NHibernate21 assembly")]

View File

@@ -16,12 +16,12 @@
<db:provider id="targetDbProvider"
provider="SqlServer-2.0"
connectionString="Data Source=(local);Database=Spring;Trusted_Connection=False"/>
connectionString="Data Source=SPRINGQA;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"/>
connectionString="Data Source=SPRINGQA;Database=Spring;Trusted_Connection=False;User ID=springqa;Password=springqa"/>

View File

@@ -5,7 +5,7 @@
<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=SPRINGQA;Database=Spring;User ID=springqa;Password=springqa;Trusted_Connection=False"/>
<!--
connectionString="Data Source=MARKT60\SQL2005;Initial Catalog=Spring;User ID=springqa; Password=springqa"/>
-->

View File

@@ -0,0 +1,29 @@
IF EXISTS (SELECT name FROM sys.databases WHERE name = N'Spring')
BEGIN
ALTER DATABASE Spring
SET SINGLE_USER
WITH ROLLBACK IMMEDIATE
DROP DATABASE Spring
END
GO
IF EXISTS (SELECT * FROM sys.server_principals WHERE name = N'springqa2')
DROP LOGIN [springqa2]
GO
CREATE DATABASE Spring
GO
CREATE LOGIN [springqa2] WITH PASSWORD=N'springqa2', DEFAULT_DATABASE=[Spring], DEFAULT_LANGUAGE=[us_english]
GO
USE Spring
CREATE USER [springqa2] FOR LOGIN [springqa2] WITH DEFAULT_SCHEMA=[dbo]
EXEC sp_addrolemember 'db_owner', 'springqa2'
GO
-- ALTERNATIVELY JUST DROP ALL TABLES:
-- EXEC sp_MSforeachtable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL';
-- EXEC sp_MSforeachtable 'ALTER TABLE ? DISABLE TRIGGER ALL';
-- EXEC sp_MSForEachTable 'DROP TABLE ?';

View File

@@ -0,0 +1,60 @@
#region License
/*
* Copyright 2002-2009 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#endregion
using 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"));
}
}
}

View File

@@ -28,6 +28,10 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Antlr3.Runtime, Version=3.1.0.39271, Culture=neutral, PublicKeyToken=3a9cab8f8d22bfb7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\NHibernate21\net\2.0\Antlr3.Runtime.dll</HintPath>
</Reference>
<Reference Include="Common.Logging, Version=1.0.2.0, Culture=neutral, PublicKeyToken=af08829b84f0328e">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\Net\2.0\Common.Logging.dll</HintPath>
@@ -44,6 +48,14 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\NHibernate21\net\2.0\NHibernate.dll</HintPath>
</Reference>
<Reference Include="NHibernate.DomainModel, Version=2.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\NHibernate21\net\2.0\NHibernate.DomainModel.dll</HintPath>
</Reference>
<Reference Include="NHibernate.Test, Version=2.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\NHibernate21\net\2.0\NHibernate.Test.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=2.4.1.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\Net\2.0\nunit.framework.dll</HintPath>
@@ -110,24 +122,20 @@
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\TestObject.cs">
<Link>Data\NHibernate\TestObject.cs</Link>
</Compile>
<Compile Include="AssemblyInfo.cs" />
<Compile Include="Setup.cs" />
</ItemGroup>
<ItemGroup>
<None Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\creditdebit.sql">
<EmbeddedResource Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\creditdebit.sql">
<Link>Data\NHibernate\creditdebit.sql</Link>
</None>
</EmbeddedResource>
<EmbeddedResource Include="RecreateDatabases.sql" />
<EmbeddedResource Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\testObject.sql">
<Link>Data\NHibernate\testObject.sql</Link>
</EmbeddedResource>
<None Include="Spring.Data.NHibernate21.Integration.Tests.build" />
<None Include="Spring.Data.NHibernate21.Integration.Tests.dll.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\..\..\projects\nhibernate\trunk\nhibernate\src\NHibernate.DomainModel\NHibernate.DomainModel.csproj">
<Project>{5C649B55-1B3F-4C38-9998-1B043E94A244}</Project>
<Name>NHibernate.DomainModel</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\..\..\..\projects\nhibernate\trunk\nhibernate\src\NHibernate.Test\NHibernate.Test.csproj">
<Project>{7AEE5B37-C552-4E59-9B6F-88755BCB5070}</Project>
<Name>NHibernate.Test</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\src\Spring\Spring.Aop\Spring.Aop.2008.csproj">
<Project>{3A3A4E65-45A6-4B20-B460-0BEDC302C02C}</Project>
<Name>Spring.Aop.2008</Name>
@@ -144,6 +152,14 @@
<Project>{AE00E5AB-C39A-436F-86D2-33BFE33E2E40}</Project>
<Name>Spring.Data.2008</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\src\Spring\Spring.Testing.NUnit\Spring.Testing.NUnit.2008.csproj">
<Project>{ED204A7B-832F-44C7-BFE3-504AEBE1BCC8}</Project>
<Name>Spring.Testing.NUnit.2008</Name>
</ProjectReference>
<ProjectReference Include="..\Spring.Core.Tests\Spring.Core.Tests.2008.csproj">
<Project>{44B16BAA-6DF8-447C-9D7F-3AD3D854D904}</Project>
<Name>Spring.Core.Tests.2008</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Data\NHibernate\Credit.hbm.xml" />

View File

@@ -1,57 +1,60 @@
<?xml version="1.0" ?>
<project name="Spring.Data.NHibernate21.Integration.Tests" default="test" xmlns="http://nant.sf.net/schemas/nant.xsd">
<!--
Required properties:
* current.bin.dir - (path) root level to build to
* current.build.debug - (true|false) debug build?
* current.build.defines.csc - framework-specific build defines for C# compiler
-->
<target name="build">
<!-- build Spring.Data.NHibernate21.Integration.Tests -->
<csc target="library" define="${current.build.defines.csc},NH_2_0,NH_2_1"
warnaserror="true"
debug="${current.build.debug}"
output="${current.bin.dir}/${project::get-name()}.dll"
doc="${current.bin.dir}/${project::get-name()}.xml">
<nowarn>
<warning number="${nowarn.numbers.test}" />
</nowarn>
<sources failonempty="true">
<include name="**/*.cs" />
<include name="../CommonAssemblyInfo.cs" />
</sources>
<references basedir="${current.bin.dir}">
<lib>
<include name="${nh21.lib.dir}"/>
</lib>
<include name="${nh21.lib.dir}/NHibernate.dll" />
<include buildfile="${spring.basedir}/common-project.include" />
<!--
Required properties:
* current.bin.dir - (path) root level to build to
* current.build.debug - (true|false) debug build?
* current.build.defines.csc - framework-specific build defines for C# compiler
-->
<target name="build">
<!-- copy nh libs -->
<echo message="NH Libs: ${nh21.lib.dir}" />
<copy todir="${current.bin.dir}" overwrite="true">
<fileset basedir="${nh21.lib.dir}">
<include name="**/*.dll" />
</fileset>
</copy>
<!-- build Spring.Data.NHibernate21.Integration.Tests -->
<csc target="library" define="${current.build.defines.csc},NH_2_0,NH_2_1"
warnaserror="true"
debug="${current.build.debug}"
output="${current.bin.dir}/${project::get-name()}.dll"
doc="${current.bin.dir}/${project::get-name()}.xml">
<nowarn>
<warning number="${nowarn.numbers.test}" />
</nowarn>
<sources failonempty="true">
<include name="**/*.cs" />
<include name="../CommonAssemblyInfo.cs" />
</sources>
<references basedir="${current.bin.dir}">
<include name="System.Data.dll" />
<include name="System.EnterpriseServices.dll" />
<include name="log4net.dll" />
<include name="*.dll" />
<exclude name="NHibernate.dll" />
<exclude name="${project::get-name()}.dll" />
<exclude name="Spring.Data.NHibernate*.dll" />
<include name="Spring.Data.NHibernate21.dll" />
</references>
<resources prefix="Spring" dynamicprefix="true" failonempty="true">
<include name="**/*.xml" />
</resources>
</csc>
<include name="Spring.Data.NHibernate21.dll" />
<exclude name="Spring.Data.NHibernate.dll" />
<exclude name="Spring.Data.NHibernate12*.dll" />
<exclude name="Spring.Data.NHibernate20*.dll" />
<exclude name="Spring.Data.NHibernate*.Tests.dll" />
</references>
<resources prefix="Spring" dynamicprefix="true" failonempty="true">
<include name="**/*.xml" />
</resources>
</csc>
<copy file="${project::get-base-directory()}/${project::get-name()}.dll.config"
tofile="${current.bin.dir}/${project::get-name()}.dll.config"/>
<copy file="${project::get-base-directory()}/${project::get-name()}.dll.config"
tofile="${current.bin.dir}/${project::get-name()}.dll.config"/>
</target>
<target name="test" depends="build">
<!-- property name="test.assemblyname" value="${project::get-name()}" / -->
<call target="common.run-tests" />
</target>
</target>
<target name="test" depends="build">
<!-- skipping running of tests for now
<nunit2outproc>
<formatter type="Plain" />
<formatter type="Xml" usefile="true" extension=".xml"
outputdir="${current.bin.dir}/results" />
<test assemblyname="${current.bin.dir}/${project::get-name()}.dll" />
</nunit2outproc>
-->
</target>
</project>

View File

@@ -58,15 +58,5 @@
<!-- property name="test.assemblyname" value="${project::get-name()}" / -->
<call target="common.run-tests" />
</target>
<!--
<target name="test" depends="build">
<nunit2outproc>
<formatter type="Plain" />
<formatter type="Xml" usefile="true" extension=".xml"
outputdir="${current.bin.dir}/results" />
<test assemblyname="${current.bin.dir}/${project::get-name()}.dll"
appconfig="${current.bin.dir}/${project::get-name()}.dll.config" />
</nunit2outproc>
</target>
-->
</project>