diff --git a/lib/NHibernate21/net/2.0/NHibernate.DomainModel.dll b/lib/NHibernate21/net/2.0/NHibernate.DomainModel.dll new file mode 100644 index 00000000..567457b2 Binary files /dev/null and b/lib/NHibernate21/net/2.0/NHibernate.DomainModel.dll differ diff --git a/lib/NHibernate21/net/2.0/NHibernate.DomainModel.xml b/lib/NHibernate21/net/2.0/NHibernate.DomainModel.xml new file mode 100644 index 00000000..2c6c6b13 --- /dev/null +++ b/lib/NHibernate21/net/2.0/NHibernate.DomainModel.xml @@ -0,0 +1,1271 @@ + + + + NHibernate.DomainModel + + + + + Summary description for AuditComponent. + + + + + Summary description for BasicClass. + + + + + + + + NHibernate knows nothing about this Property. This Property + is provided so the Test Fixtures can set and get the value of the + field _privateField to make sure that NHibernate is reading + and writing the field correctly. + + + + + Used to test how NHibernate handles mappings for type="Object" + and type="Any" + + + This class is used in two hbm.xml files. + + + + + Summary description for BasicObject. + + + + + Summary description for BasicSerializable. + + + + + Summary description for BasicTime. + + + + + Summary description for Child. + + + + + Summary description for ClassWithNullColumns. + + + + + Test the ability of CodeDOM bytecode provider to generate code that + can set a value type from a null. + + + + + A class that cannot be used with lazy="true" if proxy validation + is enabled. + + + + + Summary description for LLParent. + + + + + Summary description for LLChild. + + + + + Summary description for LLChild. + + + + + Summary description for Node. + + + + + This is the only way to hook nodes together right now. + + A Node this Node can go to. + + + + The Nodes that lead into this Node. + + + I would not recommend that mapping of set be made public because + under the scene they rely on Dictionaries, but this is in here for + testing. + + Any modifications to the "inverse" side should not be persisted - unless + the modifications are also made to the non-inverse side. + + + + + The Nodes this Node can go To. + + + I would not recommend that mapping of set be made public because + under the scene they rely on Dictionaries, but this is in here for + testing. The DestinationNodes is the Property that controls which + modifications get persisted. + + + + + A nullable type that wraps an value. + + + + + A NHibernate for a . + + + + + Abstract type used for implementing NHibernate s for + the Nullables library. + + + + + Converts a value of 0 to a DbNull + + + + + Class mapped with optimistic-lock="all" + + + + + Summary description for Parent. + + + + + Summary description for ParentComparer. + + + + + Summary description for SexType. + + + + + Summary description for SimpleComponent. + + + + + Summary description for Team. + + + + + Summary description for UnsavedType. + + + + + POCO for A + + + + + Holder for id + + + + + Holder for name + + + + + Holder for anotherName + + + + + Holder for forward + + + + + Default constructor for class A + + + + + Constructor for class A + + Initial name value + + + + Get/set for id + + + + + Get/set for name + + + + + Get/set for anotherName + + + + + POJO for Foo + + + This class is autogenerated + + + + + Default constructor for class Foo + + + + + Get/set for key + + + + + Get/set for long + + + + + Get/set for integer + + + + + Get/set for float + + + + + Get/set for x + + + + + Get/set for date + + + + + Get/set for timestamp + + + + + Get/set for boolean + + + + + Get/set for bool + + + + + Get/set for null + + + + + Get/set for short + + + + + Get/set for char + + + + + Get/set for zero + + + + + Get/set for int + + + + + Get/set for string + + + + + Get/set for byte + + + + + Get/set for yesno + + + + + Get/set for status + + + + + Get/set for locale + + + + + Get/set for formula + + + + + Get/set for custom + + + + + Get/set for version + + + + + Get/set for foo + + + + + Get/set for dependent + + + + + Gets or sets the component + + + + + Gets or sets the _time + + + + + Gets or sets the _abstract + + + + + Summary description for Assignable. + + + + + POJO for B + + + This class is autogenerated + + + + + Holder for count + + + + + Holder for map + + + + + Default constructor for class B + + + + + Constructor for class B + + Initial name value + Initial count value + Initial map value + + + + Minimal constructor for class B + + Initial map value + + + + Get/set for count + + + + + Get/set for map + + + + + Gets or sets the X + + + + + Gets or sets the _barString + + + + + Gets or sets the _barComponent + + + + + Gets or sets the _baz + + + + + Gets or sets the _name + + + + + Gets or sets the _object + + + + + Summary description for BasicNameable. + + + + + Summary description for INameable. + + + + + Default constructor for class Baz + + + + + Gets or sets the _collectionComponent + + + + + Get/set for Code + + + + + Get/set for count + + + + + Get/set for name + + + + + Get/set for Foo + + + + + Get/set for stringList + + + + + Get/set for fees + + + + + Get/set for customs + + + + + Get/set for topComponents + + + + + Get/set for fooToGlarch + + + + + Get/set for fooComponentToFoo + + + + + Get/set for glarchToFoo + + + + + Get/set for stringDateMap + + + + + Get/set for topGlarchez + + + + + Get/set for cachedMap + + + + + Get/set for stringGlarchMap + + + + + Get/set for anyToAny + + + + + Get/set for manyToAny + + + + + Gets or sets the intArray + + + + + Gets or sets the _components + + + + + Gets or sets the timeArray + + + + + Gets or sets the stringArray + + + + + Gets or sets the fooArray + + + + + Get/set for fooSet + + + + + Get/set for stringSet + + + + + Get/set for topFoos + + + + + Get/set for cascadingBars + + + + + Get/set for cached + + + + + Get/set for sortablez + + + + + Get/set for bag + + + + + Get/set for fooBag + + + + + Get/set for bazez + + + + + Get/set for idFooBag + + + + + Get/set for byteBag + + + + + Get/set for parts + + + + + Summary description for Blobber. + + + + + POJO for C1 + + + This class is autogenerated + + + + + Holder for address + + + + + Holder for d + + + + + Holder for c2 + + + + + Holder for c2s + + + + + Default constructor for class C1 + + + + + Constructor for class C1 + + Initial name value + Initial count value + Initial map value + Initial address value + Initial d value + + + + Minimal constructor for class C1 + + Initial map value + + + + Get/set for address + + + + + Get/set for d + + + + + POJO for C2 + + + This class is autogenerated + + + + + Holder for address + + + + + Holder for c1 + + + + + Holder for c1s + + + + + Default constructor for class C2 + + + + + Constructor for class C2 + + Initial name value + Initial count value + Initial map value + Initial address value + + + + Minimal constructor for class C2 + + Initial map value + + + + Get/set for address + + + + + Summary description for Category. + + + + + Summary description for Child. + + + + + Summary description for Circular. + + + + + Summary description for Component. + + + + + Holds the _foos + + + + + Holds the _str + + + + + Holds the _floats + + + + + Gets or sets the _foos + + + + + Gets or sets the _str + + + + + Gets or sets the _floats + + + + + Summary description for Componentizable. + + + + + Default constructor for class CompositeElement + + + + + Constructor for class CompositeElement + + Initial foo value + Initial bar value + + + + Get/set for foo + + + + + Get/set for bar + + + + + Summary description for Contained. + + + + + Summary description for Custom. + + + + + Summary description for CustomPersister. + + + + + POCO for D + + + + + Default constructor for class D + + + + + Constructor for class D + + Initial id value + Initial amount value + + + + Minimal constructor for class D + + Initial id value + + + + Get/set for id + + + + + Get/set for Amount + + + + + Summary description for Detail. + + + + + Summary description for Down. + + + + + Summary description for Up. + + + + + + + + + This is important, otherwise the Identifier and Instance don't match inside SessionImpl + + + + POCO for E + + + + + Get/set for id + + + + + Get/set for Amount + + + + + Summary description for Eye. + + + + + POJO for FooComponent + + + This class is autogenerated + + + + + Holder for name + + + + + Holder for count + + + + + Default constructor for class FooComponent + + + + + Constructor for class FooComponent + + Initial name value + Initial count value + + + + Get/set for name + + + + + Get/set for count + + + + + Summary description for Fumm. + + + + + Gets or sets the _next + + + + + Gets or sets the _order + + + + + Gets or sets the _strings + + + + + Gets or sets the _stringSets + + + + + Gets or sets the _fooComponents + + + + + Gets or sets the _proxyArray + + + + + Gets or sets the _proxySet + + + + + Gets or sets the _immutable + + + + + Gets or sets the _derivedVersion + + + + + Gets or sets the _any + + + + + Gets or sets the _multiple + + + + + Summary description for Holder. + + + + + Summary description for Immutable. + + + + + Summary description for Inner. + + + + + Summary description for InnerKey. + + + + + Summary description for Jay. + + + + + Summary description for Location. + + + + + Summary description for M. + + + + + Summary description for Many. + + + + + Summary description for Master. + + + + + Summary description for Middle. + + + + + Summary description for MiddleKey. + + + + + Summary description for MoreStuff. + + + + + Summary description for N. + + + + + Holds the _nested + + + + + Gets or sets the _nested + + + + + Summary description for One. + + + + + Summary description for Outer. + + + + + Summary description for OuterKey. + + + + + Summary description for Parent. + + + + + Gets or sets the _foo + + + + + Gets or sets the _created + + + + + Gets or sets the _deleted + + + + + Gets or sets the _loaded + + + + + Gets or sets the _stored + + + + + Gets or sets the _key + + + + + Gets or sets the _stuff + + + + + Gets or sets the _fums (<set>) + + + + + Gets or sets the _moreFums + + + + + Gets or sets the _childKey + + + + + Summary description for Result. + + + + + Summary description for Several. + + + + + Summary description for Single. + + + + + POJO for Sortable + + + This class is autogenerated + + + + + Holder for id + + + + + Holder for name + + + + + Default constructor for class Sortable + + + + + Constructor for class Sortable + + Initial name value + + + + Get/set for id + + + + + Get/set for name + + + + + Summary description for Stuff. + + + + + Summary description for SubComponent. + + + + + Summary description for SubDetail. + + + + + Summary description for Vetoer. + + + + + Summary description for W. + + + + + Summary description for X. + + + + + Summary description for Y. + + + + + Summary description for Z. + + + + diff --git a/lib/NHibernate21/net/2.0/NHibernate.Test.dll b/lib/NHibernate21/net/2.0/NHibernate.Test.dll new file mode 100644 index 00000000..6e54aa24 Binary files /dev/null and b/lib/NHibernate21/net/2.0/NHibernate.Test.dll differ diff --git a/lib/NHibernate21/net/2.0/NHibernate.Test.dll.config b/lib/NHibernate21/net/2.0/NHibernate.Test.dll.config new file mode 100644 index 00000000..a3ce0d1a --- /dev/null +++ b/lib/NHibernate21/net/2.0/NHibernate.Test.dll.config @@ -0,0 +1,143 @@ + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + NHibernate.Test.DebugConnectionProvider, NHibernate.Test + NHibernate.Cache.HashtableCacheProvider, NHibernate + true + false + + 10 + ReadCommitted + none + true + + + NHibernate.Driver.SqlClientDriver + NHibernate.Dialect.MsSql2005Dialect + Server=(local);initial catalog=nhibernate;Integrated Security=SSPI + + false + true + 444 + true 1, false 0, yes 'Y', no 'N' + false + + Spring.Data.NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Spring/Spring.Core/Core/IO/AssemblyResource.cs b/src/Spring/Spring.Core/Core/IO/AssemblyResource.cs index 163c6028..85fb917f 100644 --- a/src/Spring/Spring.Core/Core/IO/AssemblyResource.cs +++ b/src/Spring/Spring.Core/Core/IO/AssemblyResource.cs @@ -1,7 +1,7 @@ -#region License - +#region License + /* - * Copyright © 2002-2005 the original author or authors. + * 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. @@ -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 -{ - /// - /// An implementation for - /// resources stored within assemblies. - /// - /// - ///

- /// This implementation expects any resource name passed to the - /// constructor to adhere to the following format: - ///

- ///

- /// assembly://assemblyName/namespace/resourceName - ///

- ///
- /// Aleksandar Seovic (.NET) - /// Federico Spinazzi (.NET) - 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 - - /// - /// Creates a new instance of the - /// class. - /// - /// - /// The name of the assembly resource. - /// - /// - /// If the supplied did not conform - /// to the expected format. - /// - /// - /// If the assembly specified in the supplied - /// was loaded twice with two - /// different evidences. - /// - /// - /// If the assembly specified in the supplied - /// could not be found. - /// - /// - /// If the caller does not have the required permission to load - /// the assembly specified in the supplied - /// . - /// - /// - 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://' 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 +{ + /// + /// An implementation for + /// resources stored within assemblies. + /// + /// + ///

+ /// This implementation expects any resource name passed to the + /// constructor to adhere to the following format: + ///

+ ///

+ /// assembly://assemblyName/namespace/resourceName + ///

+ ///
+ /// Aleksandar Seovic (.NET) + /// Federico Spinazzi (.NET) + 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 + + /// + /// Creates a new instance of the + /// class. + /// + /// + /// The name of the assembly resource. + /// + /// + /// If the supplied did not conform + /// to the expected format. + /// + /// + /// If the assembly specified in the supplied + /// was loaded twice with two + /// different evidences. + /// + /// + /// If the assembly specified in the supplied + /// could not be found. + /// + /// + /// If the caller does not have the required permission to load + /// the assembly specified in the supplied + /// . + /// + /// + 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://' 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 - - /// - /// Return an for this resource. - /// - /// - /// An . - /// - /// - /// If the stream could not be opened. - /// - /// - /// If the caller does not have the required permission to load - /// the underlying assembly's manifest. - /// - /// - /// - 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; - } - } - - /// - /// Does the embedded resource specified in the value passed to the - /// constructor exist? - /// - /// - /// if this resource actually exists in physical - /// form (for example on a filesystem). - /// - /// - /// - /// - public override bool Exists - { - get - { - if (_resources == null) - { - _resources = _assembly.GetManifestResourceNames(); - Array.Sort(_resources); - } - return (Array.BinarySearch(_resources, _resourceName) >= 0); - } - } - - /// - /// Does this support relative - /// resource retrieval? - /// - /// - ///

- /// This implementation does support relative resource retrieval, and - /// so will always return . - ///

- ///
- /// - /// if this - /// supports relative resource - /// retrieval. - /// - /// - protected override bool SupportsRelativeResources - { - get { return true; } - } - - /// - /// Gets the root location of the resource (the assembly name in this - /// case). - /// - /// - /// The root location of the resource. - /// - /// - protected override string RootLocation - { - get { return _resourceAssemblyName; } - } - - /// - /// Gets the current path of the resource (the namespace in which the - /// target resource was embedded in this case). - /// - /// - /// The current path of the resource. - /// - /// - protected override string ResourcePath - { - get { return _resourceNamespace; } - } - - /// - /// Gets those characters that are valid path separators for the - /// resource type. - /// - /// - /// Those characters that are valid path separators for the resource - /// type. - /// - /// - protected override char[] PathSeparatorChars - { - get { return new char[] {'.'}; } - } - - /// - /// Returns a description for this resource. - /// - /// - /// A description for this resource. - /// - /// - public override string Description - { - get - { - return string.Format( - CultureInfo.InvariantCulture, - "assembly [{0}], resource [{1}]", _assembly.FullName, _resourceName); - } - } - -#if NET_2_0 - /// - /// Returns the handle for this resource. - /// +#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 + + /// + /// Return an for this resource. + /// + /// + /// An . + /// + /// + /// If the stream could not be opened. + /// + /// + /// If the caller does not have the required permission to load + /// the underlying assembly's manifest. + /// + /// + /// + 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; + } + } + + /// + /// Does the embedded resource specified in the value passed to the + /// constructor exist? + /// + /// + /// if this resource actually exists in physical + /// form (for example on a filesystem). + /// + /// + /// + /// + public override bool Exists + { + get + { + if (_resources == null) + { + _resources = _assembly.GetManifestResourceNames(); + Array.Sort(_resources); + } + return (Array.BinarySearch(_resources, _resourceName) >= 0); + } + } + + /// + /// Does this support relative + /// resource retrieval? + /// + /// + ///

+ /// This implementation does support relative resource retrieval, and + /// so will always return . + ///

+ ///
+ /// + /// if this + /// supports relative resource + /// retrieval. + /// + /// + protected override bool SupportsRelativeResources + { + get { return true; } + } + + /// + /// Gets the root location of the resource (the assembly name in this + /// case). + /// + /// + /// The root location of the resource. + /// + /// + protected override string RootLocation + { + get { return _resourceAssemblyName; } + } + + /// + /// Gets the current path of the resource (the namespace in which the + /// target resource was embedded in this case). + /// + /// + /// The current path of the resource. + /// + /// + protected override string ResourcePath + { + get { return _resourceNamespace; } + } + + /// + /// Gets those characters that are valid path separators for the + /// resource type. + /// + /// + /// Those characters that are valid path separators for the resource + /// type. + /// + /// + protected override char[] PathSeparatorChars + { + get { return new char[] { '.' }; } + } + + /// + /// Returns a description for this resource. + /// + /// + /// A description for this resource. + /// + /// + public override string Description + { + get + { + return string.Format( + CultureInfo.InvariantCulture, + "assembly [{0}], resource [{1}]", _assembly.FullName, _resourceName); + } + } + +#if NET_2_0 + /// + /// Returns the handle for this resource. + /// /// public override Uri Uri { @@ -259,26 +258,26 @@ namespace Spring.Core.IO { return new Uri(_fullResourceName); } - } -#endif - #endregion - - /// - /// Does the supplied relative ? - /// - /// - /// The name of the resource to test. - /// - /// - /// if resource name is relative; - /// otherwise . - /// - protected override bool IsRelativeResource(string resourceName) - { - return (resourceName.StartsWith("./") || - resourceName.StartsWith("/") || - resourceName.StartsWith("../") || - resourceName.Split('/').Length != 3); - } - } + } +#endif + #endregion + + /// + /// Does the supplied relative ? + /// + /// + /// The name of the resource to test. + /// + /// + /// if resource name is relative; + /// otherwise . + /// + protected override bool IsRelativeResource(string resourceName) + { + return (resourceName.StartsWith("./") || + resourceName.StartsWith("/") || + resourceName.StartsWith("../") || + resourceName.Split('/').Length != 3); + } + } } \ No newline at end of file diff --git a/src/Spring/Spring.Testing.NUnit/Testing/Ado/SimpleAdoTestUtils.cs b/src/Spring/Spring.Testing.NUnit/Testing/Ado/SimpleAdoTestUtils.cs index df34ce0f..aa41f108 100644 --- a/src/Spring/Spring.Testing.NUnit/Testing/Ado/SimpleAdoTestUtils.cs +++ b/src/Spring/Spring.Testing.NUnit/Testing/Ado/SimpleAdoTestUtils.cs @@ -95,11 +95,19 @@ namespace Spring.Testing.Ado /// /// Execute the given script /// - 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); } + /// + /// Execute the given script + /// + public static void ExecuteSqlScript(IAdoOperations adoTemplate, string script, bool continueOnError, params Regex[] blockDelimiter) + { + ExecuteSqlScriptInternal(adoTemplate, new EncodedResource(new StringResource(script)), continueOnError, blockDelimiter); + } + /// /// Execute the given script /// @@ -108,6 +116,14 @@ namespace Spring.Testing.Ado ExecuteSqlScriptInternal(adoTemplate, new EncodedResource(resourceLoader.GetResource(scriptResourcePath)), continueOnError, blockDelimiter); } + /// + /// Execute the given script + /// + public static void ExecuteSqlScript(IAdoOperations adoTemplate, IResource resource, params Regex[] blockDelimiter) + { + ExecuteSqlScriptInternal(adoTemplate, new EncodedResource(resource), false, blockDelimiter); + } + /// /// Execute the given script /// diff --git a/test/Spring/Spring.Core.Tests/TestResourceLoader.cs b/test/Spring/Spring.Core.Tests/TestResourceLoader.cs index 6280d540..3d01f02b 100644 --- a/test/Spring/Spring.Core.Tests/TestResourceLoader.cs +++ b/test/Spring/Spring.Core.Tests/TestResourceLoader.cs @@ -189,7 +189,18 @@ namespace Spring /// 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; + } + + /// + /// 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") + /// + /// + public static string GetAssemblyResourceUri(object hint, string name) + { + Type hintType = hint.GetType(); + return GetAssemblyResourceUri(hintType, name); } } } diff --git a/test/Spring/Spring.Data.NHibernate.Integration.Tests/Data/NHibernate/creditdebit.sql b/test/Spring/Spring.Data.NHibernate.Integration.Tests/Data/NHibernate/creditdebit.sql index 88aaf966..cb19869f 100644 --- a/test/Spring/Spring.Data.NHibernate.Integration.Tests/Data/NHibernate/creditdebit.sql +++ b/test/Spring/Spring.Data.NHibernate.Integration.Tests/Data/NHibernate/creditdebit.sql @@ -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] \ No newline at end of file +) ON [PRIMARY] +; \ No newline at end of file diff --git a/test/Spring/Spring.Data.NHibernate.Integration.Tests/Data/NHibernate/testObject.sql b/test/Spring/Spring.Data.NHibernate.Integration.Tests/Data/NHibernate/testObject.sql index 805846b5..bbd60d26 100644 --- a/test/Spring/Spring.Data.NHibernate.Integration.Tests/Data/NHibernate/testObject.sql +++ b/test/Spring/Spring.Data.NHibernate.Integration.Tests/Data/NHibernate/testObject.sql @@ -7,4 +7,4 @@ CREATE TABLE [TestObjects] ( ( [TestObjectNo] ASC ) -) \ No newline at end of file +); \ No newline at end of file diff --git a/test/Spring/Spring.Data.NHibernate.Tests/Data/NHibernate/LocalSessionFactoryObjectTests.cs b/test/Spring/Spring.Data.NHibernate.Tests/Data/NHibernate/LocalSessionFactoryObjectTests.cs index b4262d0e..29f2c89a 100644 --- a/test/Spring/Spring.Data.NHibernate.Tests/Data/NHibernate/LocalSessionFactoryObjectTests.cs +++ b/test/Spring/Spring.Data.NHibernate.Tests/Data/NHibernate/LocalSessionFactoryObjectTests.cs @@ -1,7 +1,7 @@ #region License /* - * Copyright © 2002-2007 the original author or authors. + * 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. @@ -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 { diff --git a/test/Spring/Spring.Data.NHibernate21.Integration.Tests/AssemblyInfo.cs b/test/Spring/Spring.Data.NHibernate21.Integration.Tests/AssemblyInfo.cs deleted file mode 100644 index 287e6ef5..00000000 --- a/test/Spring/Spring.Data.NHibernate21.Integration.Tests/AssemblyInfo.cs +++ /dev/null @@ -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")] diff --git a/test/Spring/Spring.Data.NHibernate21.Integration.Tests/Data/NHibernate/dbProviderTemplateTests.xml b/test/Spring/Spring.Data.NHibernate21.Integration.Tests/Data/NHibernate/dbProviderTemplateTests.xml index a1056203..2f20a172 100644 --- a/test/Spring/Spring.Data.NHibernate21.Integration.Tests/Data/NHibernate/dbProviderTemplateTests.xml +++ b/test/Spring/Spring.Data.NHibernate21.Integration.Tests/Data/NHibernate/dbProviderTemplateTests.xml @@ -16,12 +16,12 @@ + connectionString="Data Source=SPRINGQA;Database=Spring;Trusted_Connection=False"/> + connectionString="Data Source=SPRINGQA;Database=Spring;Trusted_Connection=False;User ID=springqa;Password=springqa"/> diff --git a/test/Spring/Spring.Data.NHibernate21.Integration.Tests/Data/NHibernate/templateTests.xml b/test/Spring/Spring.Data.NHibernate21.Integration.Tests/Data/NHibernate/templateTests.xml index e6a135ed..77dceeb6 100644 --- a/test/Spring/Spring.Data.NHibernate21.Integration.Tests/Data/NHibernate/templateTests.xml +++ b/test/Spring/Spring.Data.NHibernate21.Integration.Tests/Data/NHibernate/templateTests.xml @@ -5,7 +5,7 @@ + connectionString="Data Source=SPRINGQA;Database=Spring;User ID=springqa;Password=springqa;Trusted_Connection=False"/> diff --git a/test/Spring/Spring.Data.NHibernate21.Integration.Tests/RecreateDatabases.sql b/test/Spring/Spring.Data.NHibernate21.Integration.Tests/RecreateDatabases.sql new file mode 100644 index 00000000..347e8482 --- /dev/null +++ b/test/Spring/Spring.Data.NHibernate21.Integration.Tests/RecreateDatabases.sql @@ -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 ?'; diff --git a/test/Spring/Spring.Data.NHibernate21.Integration.Tests/Setup.cs b/test/Spring/Spring.Data.NHibernate21.Integration.Tests/Setup.cs new file mode 100644 index 00000000..8a7556b6 --- /dev/null +++ b/test/Spring/Spring.Data.NHibernate21.Integration.Tests/Setup.cs @@ -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 +{ + /// + /// + /// Erich Eichinger + [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")); + } + } +} \ No newline at end of file diff --git a/test/Spring/Spring.Data.NHibernate21.Integration.Tests/Spring.Data.NHibernate21.Integration.Tests.2008.csproj b/test/Spring/Spring.Data.NHibernate21.Integration.Tests/Spring.Data.NHibernate21.Integration.Tests.2008.csproj index a26a7978..2a6e4d93 100644 --- a/test/Spring/Spring.Data.NHibernate21.Integration.Tests/Spring.Data.NHibernate21.Integration.Tests.2008.csproj +++ b/test/Spring/Spring.Data.NHibernate21.Integration.Tests/Spring.Data.NHibernate21.Integration.Tests.2008.csproj @@ -28,6 +28,10 @@ 4 + + False + ..\..\..\lib\NHibernate21\net\2.0\Antlr3.Runtime.dll + False ..\..\..\lib\Net\2.0\Common.Logging.dll @@ -44,6 +48,14 @@ False ..\..\..\lib\NHibernate21\net\2.0\NHibernate.dll + + False + ..\..\..\lib\NHibernate21\net\2.0\NHibernate.DomainModel.dll + + + False + ..\..\..\lib\NHibernate21\net\2.0\NHibernate.Test.dll + False ..\..\..\lib\Net\2.0\nunit.framework.dll @@ -110,24 +122,20 @@ Data\NHibernate\TestObject.cs - + - + Data\NHibernate\creditdebit.sql - + + + + Data\NHibernate\testObject.sql + - - {5C649B55-1B3F-4C38-9998-1B043E94A244} - NHibernate.DomainModel - - - {7AEE5B37-C552-4E59-9B6F-88755BCB5070} - NHibernate.Test - {3A3A4E65-45A6-4B20-B460-0BEDC302C02C} Spring.Aop.2008 @@ -144,6 +152,14 @@ {AE00E5AB-C39A-436F-86D2-33BFE33E2E40} Spring.Data.2008 + + {ED204A7B-832F-44C7-BFE3-504AEBE1BCC8} + Spring.Testing.NUnit.2008 + + + {44B16BAA-6DF8-447C-9D7F-3AD3D854D904} + Spring.Core.Tests.2008 + diff --git a/test/Spring/Spring.Data.NHibernate21.Integration.Tests/Spring.Data.NHibernate21.Integration.Tests.build b/test/Spring/Spring.Data.NHibernate21.Integration.Tests/Spring.Data.NHibernate21.Integration.Tests.build index 3b76927e..778f2d93 100644 --- a/test/Spring/Spring.Data.NHibernate21.Integration.Tests/Spring.Data.NHibernate21.Integration.Tests.build +++ b/test/Spring/Spring.Data.NHibernate21.Integration.Tests/Spring.Data.NHibernate21.Integration.Tests.build @@ -1,57 +1,60 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - + + + + + + + + - - - - diff --git a/test/Spring/Spring.Data.NHibernate21.Tests/Spring.Data.NHibernate21.Tests.build b/test/Spring/Spring.Data.NHibernate21.Tests/Spring.Data.NHibernate21.Tests.build index 778e02d2..1a28a5b4 100644 --- a/test/Spring/Spring.Data.NHibernate21.Tests/Spring.Data.NHibernate21.Tests.build +++ b/test/Spring/Spring.Data.NHibernate21.Tests/Spring.Data.NHibernate21.Tests.build @@ -58,15 +58,5 @@ - +