From: Sergey K. <jus...@us...> - 2005-05-05 19:28:42
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21725/src/NHibernate.Test Modified Files: ABCProxyTest.cs ABCTest.cs AssemblyInfo.cs CriteriaTest.cs FooBarTest.cs FumTest.cs MasterDetailTest.cs MultiTableTest.cs ParentChildTest.cs PerformanceTest.cs SQLFunctionsTest.cs SQLLoaderTest.cs SimpleTest.cs TestCase.cs Log Message: * Better SQLite support - only about 20 test cases fail on SQLite, mostly due to bugs in SQLite ADO.NET provider * Modified TestCase to clean up unclosed sessions in TearDown - not completely bullet-proof, since some tests don't call TearDown, but covers a lot of the cases. * Changed sessions.OpenSession() to OpenSession() in all tests * Added Dialect.SupportsSubSelects property for use in tests instead of (dialect is SomeDialect) expressions. Index: CriteriaTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/CriteriaTest.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** CriteriaTest.cs 1 Jan 2005 20:39:38 -0000 1.8 --- CriteriaTest.cs 5 May 2005 19:27:52 -0000 1.9 *************** *** 46,50 **** { // create the objects to search on ! ISession s1 = sessions.OpenSession(); ITransaction t1 = s1.BeginTransaction(); --- 46,50 ---- { // create the objects to search on ! ISession s1 = OpenSession(); ITransaction t1 = s1.BeginTransaction(); *************** *** 69,73 **** s1.Close(); ! ISession s2 = sessions.OpenSession(); ITransaction t2 = s2.BeginTransaction(); --- 69,73 ---- s1.Close(); ! ISession s2 = OpenSession(); ITransaction t2 = s2.BeginTransaction(); *************** *** 105,109 **** s2.Date = new DateTime( 2006, 01, 01 ); ! ISession s = sessions.OpenSession(); s.Save( s1, 1 ); s.Save( s2, 2 ); --- 105,109 ---- s2.Date = new DateTime( 2006, 01, 01 ); ! ISession s = OpenSession(); s.Save( s1, 1 ); s.Save( s2, 2 ); *************** *** 111,115 **** s.Close(); ! s = sessions.OpenSession(); IList results = s.CreateCriteria( typeof(Simple) ) .Add( Expression.Expression.Gt( "Date", new DateTime( 2005, 01, 01 ) ) ) --- 111,115 ---- s.Close(); ! s = OpenSession(); IList results = s.CreateCriteria( typeof(Simple) ) .Add( Expression.Expression.Gt( "Date", new DateTime( 2005, 01, 01 ) ) ) Index: SimpleTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/SimpleTest.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** SimpleTest.cs 17 Jan 2005 03:40:51 -0000 1.8 --- SimpleTest.cs 5 May 2005 19:27:53 -0000 1.9 *************** *** 48,78 **** long otherKey = 9; ! ISession s1 = sessions.OpenSession(); ! ITransaction t1 = s1.BeginTransaction(); ! ! // create a new ! Simple simple1 = new Simple(); ! Simple otherSimple1 = new Simple(); ! simple1.Name = "Simple 1"; ! simple1.Address = "Street 12"; ! simple1.Date = testDateTime; ! simple1.Count = 99; ! otherSimple1.Name = "Other Simple 1"; ! otherSimple1.Address = "Other Street 12"; ! otherSimple1.Date = testDateTime; ! otherSimple1.Count = 98; ! simple1.Other = otherSimple1; ! s1.Save(otherSimple1, otherKey); ! s1.Save(simple1, key); ! t1.Commit(); ! s1.Close(); // try to Load the object to make sure the save worked ! ISession s2 = sessions.OpenSession(); ITransaction t2 = s2.BeginTransaction(); --- 48,78 ---- long otherKey = 9; ! using( ISession s1 = OpenSession() ) ! using( ITransaction t1 = s1.BeginTransaction() ) ! { ! // create a new ! Simple simple1 = new Simple(); ! Simple otherSimple1 = new Simple(); ! simple1.Name = "Simple 1"; ! simple1.Address = "Street 12"; ! simple1.Date = testDateTime; ! simple1.Count = 99; ! otherSimple1.Name = "Other Simple 1"; ! otherSimple1.Address = "Other Street 12"; ! otherSimple1.Date = testDateTime; ! otherSimple1.Count = 98; ! simple1.Other = otherSimple1; ! s1.Save(otherSimple1, otherKey); ! s1.Save(simple1, key); ! t1.Commit(); ! } // try to Load the object to make sure the save worked ! ISession s2 = OpenSession(); ITransaction t2 = s2.BeginTransaction(); *************** *** 97,101 **** // lets verify that the update worked ! ISession s3 = sessions.OpenSession(); ITransaction t3 = s3.BeginTransaction(); --- 97,101 ---- // lets verify that the update worked ! ISession s3 = OpenSession(); ITransaction t3 = s3.BeginTransaction(); *************** *** 121,125 **** // verify there is no other Simple objects in the db ! ISession s4 = sessions.OpenSession(); Assert.AreEqual(0, s4.CreateCriteria(typeof(Simple)).List().Count); s4.Close(); --- 121,125 ---- // verify there is no other Simple objects in the db ! ISession s4 = OpenSession(); Assert.AreEqual(0, s4.CreateCriteria(typeof(Simple)).List().Count); s4.Close(); *************** *** 133,137 **** DateTime now = DateTime.Now; ! ISession s = sessions.OpenSession(); ITransaction t = s.BeginTransaction(); --- 133,137 ---- DateTime now = DateTime.Now; ! ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); Index: SQLFunctionsTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/SQLFunctionsTest.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** SQLFunctionsTest.cs 9 Apr 2005 12:48:06 -0000 1.9 --- SQLFunctionsTest.cs 5 May 2005 19:27:52 -0000 1.10 *************** *** 53,57 **** public void SetProperties() { ! ISession s = sessions.OpenSession(); ITransaction t = s.BeginTransaction(); Simple simple = new Simple(); --- 53,57 ---- public void SetProperties() { ! ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); Simple simple = new Simple(); *************** *** 76,80 **** public void NothingToUpdate() { ! ISession s = sessions.OpenSession(); ITransaction t = s.BeginTransaction(); Simple simple = new Simple(); --- 76,80 ---- public void NothingToUpdate() { ! ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); Simple simple = new Simple(); *************** *** 84,88 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); s.Update( simple, (long)10 ); --- 84,88 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); s.Update( simple, (long)10 ); *************** *** 90,94 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); s.Update( simple, (long)10 ); --- 90,94 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); s.Update( simple, (long)10 ); *************** *** 126,130 **** public void SQLFunctions() { ! using( ISession s = sessions.OpenSession() ) { ITransaction t = s.BeginTransaction(); --- 126,130 ---- public void SQLFunctions() { ! using( ISession s = OpenSession() ) { ITransaction t = s.BeginTransaction(); *************** *** 186,192 **** s.Save( min, (long)30 ); ! // && !(dialect is Dialect.HSQLDialect) ! // MySql has no subqueries ! if( !(dialect is Dialect.MySQLDialect) ) { Assert.AreEqual( 2, s.Find("from s in class Simple where s.Count > ( select min(sim.Count) from sim in class NHibernate.DomainModel.Simple )").Count ); --- 186,190 ---- s.Save( min, (long)30 ); ! if( dialect.SupportsSubSelects ) { Assert.AreEqual( 2, s.Find("from s in class Simple where s.Count > ( select min(sim.Count) from sim in class NHibernate.DomainModel.Simple )").Count ); *************** *** 202,206 **** Assert.IsFalse( enumer.MoveNext() ); ! if( !(dialect is Dialect.MySQLDialect) ) { enumer = s.Enumerable("select s.Count from s in class Simple group by s.Count having s.Count = 12").GetEnumerator(); --- 200,204 ---- Assert.IsFalse( enumer.MoveNext() ); ! if( dialect.SupportsSubSelects ) { enumer = s.Enumerable("select s.Count from s in class Simple group by s.Count having s.Count = 12").GetEnumerator(); Index: MultiTableTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/MultiTableTest.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** MultiTableTest.cs 31 Mar 2005 12:42:39 -0000 1.9 --- MultiTableTest.cs 5 May 2005 19:27:52 -0000 1.10 *************** *** 31,35 **** public void Joins() { ! ISession s = sessions.OpenSession(); s.Find("from SubMulti sm join sm.Children smc where smc.Name > 'a'"); s.Find("select s, ya from LessSimple s join s.YetAnother ya"); --- 31,35 ---- public void Joins() { ! ISession s = OpenSession(); s.Find("from SubMulti sm join sm.Children smc where smc.Name > 'a'"); s.Find("select s, ya from LessSimple s join s.YetAnother ya"); *************** *** 52,59 **** { } [Test] public void SubclassCollection() { ! ISession s = sessions.OpenSession(); SubMulti sm = new SubMulti(); SubMulti sm1 = new SubMulti(); --- 52,60 ---- { } + [Test] public void SubclassCollection() { ! ISession s = OpenSession(); SubMulti sm = new SubMulti(); SubMulti sm1 = new SubMulti(); *************** *** 75,79 **** s.Close(); ! s = sessions.OpenSession(); // TODO: I don't understand why h2.0.3 issues a select statement here --- 76,80 ---- s.Close(); ! s = OpenSession(); // TODO: I don't understand why h2.0.3 issues a select statement here *************** *** 112,116 **** public void CollectionOnly() { ! ISession s = sessions.OpenSession(); ITransaction t = s.BeginTransaction(); Mono m = new Mono(); --- 113,117 ---- public void CollectionOnly() { ! ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); Mono m = new Mono(); *************** *** 119,123 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); s.Update(m, id); --- 120,124 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); s.Update(m, id); *************** *** 133,137 **** public void Queries() { ! ISession s = sessions.OpenSession(); long id = 1L; --- 134,138 ---- public void Queries() { ! ISession s = OpenSession(); long id = 1L; *************** *** 148,152 **** s.Close(); ! s = sessions.OpenSession(); TrivialClass tc = (TrivialClass)s.Load( typeof(TrivialClass), id ); s.Find("from s in class TrivialClass where s.id = 2"); --- 149,153 ---- s.Close(); ! s = OpenSession(); TrivialClass tc = (TrivialClass)s.Load( typeof(TrivialClass), id ); s.Find("from s in class TrivialClass where s.id = 2"); *************** *** 169,173 **** public void Constraints() { ! ISession s = sessions.OpenSession(); ITransaction t = s.BeginTransaction(); SubMulti sm = new SubMulti(); --- 170,174 ---- public void Constraints() { ! ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); SubMulti sm = new SubMulti(); *************** *** 184,188 **** s.Close(); ! s = sessions.OpenSession(); s.Delete( "from sm in class SubMulti" ); t = s.BeginTransaction(); --- 185,189 ---- s.Close(); ! s = OpenSession(); s.Delete( "from sm in class SubMulti" ); t = s.BeginTransaction(); *************** *** 194,198 **** public void MultiTable() { ! ISession s = sessions.OpenSession(); ITransaction t = s.BeginTransaction(); Multi multi = new Multi(); --- 195,199 ---- public void MultiTable() { ! ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); Multi multi = new Multi(); *************** *** 231,235 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); multi.ExtraProp = multi.ExtraProp + "2"; --- 232,236 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); multi.ExtraProp = multi.ExtraProp + "2"; *************** *** 243,247 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); multi = (Multi)s.Load( typeof(Multi), mid ); --- 244,248 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); multi = (Multi)s.Load( typeof(Multi), mid ); *************** *** 256,260 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); multi = (Multi)s.Load( typeof(Simple), mid ); --- 257,261 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); multi = (Multi)s.Load( typeof(Simple), mid ); *************** *** 268,272 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); IEnumerator enumer = s.Enumerable("select\n\ns from s in class Simple where s.Count>0").GetEnumerator(); --- 269,273 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); IEnumerator enumer = s.Enumerable("select\n\ns from s in class Simple where s.Count>0").GetEnumerator(); *************** *** 310,314 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); multi = (Multi)s.Load( typeof(Simple), mid, LockMode.Upgrade ); --- 311,315 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); multi = (Multi)s.Load( typeof(Simple), mid, LockMode.Upgrade ); *************** *** 318,322 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); s.Update( multi, mid ); --- 319,323 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); s.Update( multi, mid ); *************** *** 332,336 **** public void MutliTableGeneratedId() { ! ISession s = sessions.OpenSession(); ITransaction t = s.BeginTransaction(); Multi multi = new Multi(); --- 333,337 ---- public void MutliTableGeneratedId() { ! ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); Multi multi = new Multi(); *************** *** 348,352 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); multi.ExtraProp += "2"; --- 349,353 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); multi.ExtraProp += "2"; *************** *** 360,364 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); multi = (Multi)s.Load( typeof(Multi), multiId ); --- 361,365 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); multi = (Multi)s.Load( typeof(Multi), multiId ); *************** *** 373,377 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); multi = (Multi)s.Load( typeof(Simple), multiId ); --- 374,378 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); multi = (Multi)s.Load( typeof(Simple), multiId ); *************** *** 385,389 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); IEnumerable enumer = s.Enumerable("select\n\ns from s in class Simple where s.Count>0"); --- 386,390 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); IEnumerable enumer = s.Enumerable("select\n\ns from s in class Simple where s.Count>0"); *************** *** 419,423 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); multi = (Multi)s.Load( typeof(Simple), multiId, LockMode.Upgrade ); --- 420,424 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); multi = (Multi)s.Load( typeof(Simple), multiId, LockMode.Upgrade ); *************** *** 427,431 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); s.Update( multi, multiId ); --- 428,432 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); s.Update( multi, multiId ); *************** *** 441,445 **** //if( dialect is Dialect.HSQLDialect) return; ! ISession s = sessions.OpenSession(); ITransaction t = s.BeginTransaction(); Assert.AreEqual( 0, s.Find("from s in class Simple").Count ); --- 442,446 ---- //if( dialect is Dialect.HSQLDialect) return; ! ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); Assert.AreEqual( 0, s.Find("from s in class Simple").Count ); *************** *** 489,493 **** Assert.AreSame( ls, ls.YetAnother ); ! s = sessions.OpenSession(); t = s.BeginTransaction(); ls = (LessSimple)s.Load( typeof(LessSimple), id ); --- 490,494 ---- Assert.AreSame( ls, ls.YetAnother ); ! s = OpenSession(); t = s.BeginTransaction(); ls = (LessSimple)s.Load( typeof(LessSimple), id ); *************** *** 519,523 **** //if( dialect is Dialect.HSQLDialect) return; ! ISession s = sessions.OpenSession(); ITransaction t = s.BeginTransaction(); Assert.AreEqual( 0, s.Find("from s in class Simple").Count ); --- 520,524 ---- //if( dialect is Dialect.HSQLDialect) return; ! ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); Assert.AreEqual( 0, s.Find("from s in class Simple").Count ); *************** *** 561,565 **** Assert.AreSame(ls, ls.YetAnother); ! s = sessions.OpenSession(); t = s.BeginTransaction(); ls = (LessSimple)s.Load( typeof(LessSimple), id ); --- 562,566 ---- Assert.AreSame(ls, ls.YetAnother); ! s = OpenSession(); t = s.BeginTransaction(); ls = (LessSimple)s.Load( typeof(LessSimple), id ); *************** *** 578,582 **** public void MultiTableNativeId() { ! ISession s = sessions.OpenSession(); ITransaction t = s.BeginTransaction(); Multi multi = new Multi(); --- 579,583 ---- public void MultiTableNativeId() { ! ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); Multi multi = new Multi(); *************** *** 592,596 **** public void Collection() { ! ISession s = sessions.OpenSession(); ITransaction t = s.BeginTransaction(); Multi multi1 = new Multi(); --- 593,597 ---- public void Collection() { ! ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); Multi multi1 = new Multi(); *************** *** 611,615 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); po = (Po)s.Load( typeof(Po), id ); --- 612,616 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); po = (Po)s.Load( typeof(Po), id ); *************** *** 626,630 **** public void OneToOne() { ! ISession s = sessions.OpenSession(); LessSimple ls = new LessSimple(); object id = s.Save(ls); --- 627,631 ---- public void OneToOne() { ! ISession s = OpenSession(); LessSimple ls = new LessSimple(); object id = s.Save(ls); *************** *** 632,640 **** s.Close(); ! s = sessions.OpenSession(); s.Load( typeof(LessSimple), id ); s.Close(); ! s = sessions.OpenSession(); s.Delete( s.Load( typeof(LessSimple), id ) ); s.Flush(); --- 633,641 ---- s.Close(); ! s = OpenSession(); s.Load( typeof(LessSimple), id ); s.Close(); ! s = OpenSession(); s.Delete( s.Load( typeof(LessSimple), id ) ); s.Flush(); *************** *** 645,649 **** public void CollectionPointer() { ! ISession s = sessions.OpenSession(); LessSimple ls = new LessSimple(); IList list = new ArrayList(); --- 646,650 ---- public void CollectionPointer() { ! ISession s = OpenSession(); LessSimple ls = new LessSimple(); IList list = new ArrayList(); *************** *** 657,661 **** s.Close(); ! s = sessions.OpenSession(); ls = (LessSimple)s.Load( typeof(LessSimple), id ); Assert.AreEqual( 1, ls.Bag.Count ); --- 658,662 ---- s.Close(); ! s = OpenSession(); ls = (LessSimple)s.Load( typeof(LessSimple), id ); Assert.AreEqual( 1, ls.Bag.Count ); *************** *** 668,672 **** public void DynamicUpdate() { ! ISession s = sessions.OpenSession(); Simple simple = new Simple(); --- 669,673 ---- public void DynamicUpdate() { ! ISession s = OpenSession(); Simple simple = new Simple(); *************** *** 679,683 **** s.Close(); ! s = sessions.OpenSession(); simple = (Simple)s.Load( typeof(Simple), id ); Assert.AreEqual( "updated", simple.Name, "name should have been updated" ); --- 680,684 ---- s.Close(); ! s = OpenSession(); simple = (Simple)s.Load( typeof(Simple), id ); Assert.AreEqual( "updated", simple.Name, "name should have been updated" ); Index: ParentChildTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/ParentChildTest.cs,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ParentChildTest.cs 31 Mar 2005 12:42:39 -0000 1.13 --- ParentChildTest.cs 5 May 2005 19:27:52 -0000 1.14 *************** *** 95,99 **** public void CollectionQuery() { ! ISession s = sessions.OpenSession(); ITransaction t = s.BeginTransaction(); --- 95,99 ---- public void CollectionQuery() { ! ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); *************** *** 129,133 **** Assert.AreEqual( 1, s.Find("select c from c in class ContainerX where 's' = c.OneToMany[2 - 2].Name").Count ); Assert.AreEqual( 1, s.Find("select c from c in class ContainerX where 's' = c.ManyToMany[(3+1)/4-1].Name").Count ); ! if( !(dialect is Dialect.MySQLDialect) ) { Assert.AreEqual( 1, s.Find("select c from c in class ContainerX where c.ManyToMany[ c.ManyToMany.maxIndex ].Count = 2").Count ); --- 129,133 ---- Assert.AreEqual( 1, s.Find("select c from c in class ContainerX where 's' = c.OneToMany[2 - 2].Name").Count ); Assert.AreEqual( 1, s.Find("select c from c in class ContainerX where 's' = c.ManyToMany[(3+1)/4-1].Name").Count ); ! if( dialect.SupportsSubSelects ) { Assert.AreEqual( 1, s.Find("select c from c in class ContainerX where c.ManyToMany[ c.ManyToMany.maxIndex ].Count = 2").Count ); *************** *** 150,154 **** public void ParentChild() { ! ISession s = sessions.OpenSession(); ITransaction t = s.BeginTransaction(); Parent p = new Parent(); --- 150,154 ---- public void ParentChild() { ! ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); Parent p = new Parent(); *************** *** 161,165 **** s.Flush(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); c = (Child)s.Load( typeof(Child), c.Id ); --- 161,165 ---- s.Flush(); ! s = OpenSession(); t = s.BeginTransaction(); c = (Child)s.Load( typeof(Child), c.Id ); *************** *** 171,175 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); c = (Child)s.Load( typeof(Child), c.Id ); --- 171,175 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); c = (Child)s.Load( typeof(Child), c.Id ); *************** *** 193,197 **** public void ParentNullChild() { ! ISession s = sessions.OpenSession(); ITransaction t = s.BeginTransaction(); Parent p = new Parent(); --- 193,197 ---- public void ParentNullChild() { ! ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); Parent p = new Parent(); *************** *** 200,204 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); p = (Parent)s.Load( typeof(Parent), p.Id ); --- 200,204 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); p = (Parent)s.Load( typeof(Parent), p.Id ); *************** *** 208,212 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); p = (Parent)s.Load( typeof(Parent), p.Id ); --- 208,212 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); p = (Parent)s.Load( typeof(Parent), p.Id ); *************** *** 224,228 **** // if( dialect is Dialect.HSQLDialect) return; ! ISession s = sessions.OpenSession(); ITransaction t = s.BeginTransaction(); Container c = new Container(); --- 224,228 ---- // if( dialect is Dialect.HSQLDialect) return; ! ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); Container c = new Container(); *************** *** 245,249 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); c = (Container) s.Load( typeof(Container), cid ); --- 245,249 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); c = (Container) s.Load( typeof(Container), cid ); *************** *** 262,266 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); c = (Container) s.Load( typeof(Container), cid ); --- 262,266 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); c = (Container) s.Load( typeof(Container), cid ); *************** *** 279,283 **** public void Container() { ! ISession s = sessions.OpenSession(); ITransaction t = s.BeginTransaction(); Container c = new Container(); --- 279,283 ---- public void Container() { ! ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); Container c = new Container(); *************** *** 327,331 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); c = (Container)s.Load( typeof(Container), c.Id ); --- 327,331 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); c = (Container)s.Load( typeof(Container), c.Id ); *************** *** 355,359 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); c = (Container)s.Load( typeof(Container), c.Id ); --- 355,359 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); c = (Container)s.Load( typeof(Container), c.Id ); *************** *** 372,376 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); c = (Container)s.Load( typeof(Container), c.Id ); --- 372,376 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); c = (Container)s.Load( typeof(Container), c.Id ); *************** *** 399,403 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); c = (Container)s.Load( typeof(Container), c.Id ); --- 399,403 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); c = (Container)s.Load( typeof(Container), c.Id ); *************** *** 424,433 **** cic.One = new One(); list.Add(cic); ! ISession s = sessions.OpenSession(); s.Save(c); s.Flush(); s.Close(); ! s = sessions.OpenSession(); foreach(Container obj in s.Enumerable("from c in class ContainerX")) { --- 424,433 ---- cic.One = new One(); list.Add(cic); ! ISession s = OpenSession(); s.Save(c); s.Flush(); s.Close(); ! s = OpenSession(); foreach(Container obj in s.Enumerable("from c in class ContainerX")) { *************** *** 448,452 **** c = new Container(); ! s = sessions.OpenSession(); s.Save(c); list = new ArrayList(); --- 448,452 ---- c = new Container(); ! s = OpenSession(); s.Save(c); list = new ArrayList(); *************** *** 459,463 **** s.Close(); ! s = sessions.OpenSession(); foreach( Container obj in s.Enumerable("from c in class ContainerX") ) { --- 459,463 ---- s.Close(); ! s = OpenSession(); foreach( Container obj in s.Enumerable("from c in class ContainerX") ) { *************** *** 482,486 **** //if( dialect is Dialect.HSQLDialect ) return; ! ISession s = sessions.OpenSession(); ITransaction t = s.BeginTransaction(); Container c = new Container(); --- 482,486 ---- //if( dialect is Dialect.HSQLDialect ) return; ! ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); Container c = new Container(); *************** *** 500,504 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); c = (Container)s.Find("from c in class ContainerX")[0]; --- 500,504 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); c = (Container)s.Find("from c in class ContainerX")[0]; *************** *** 507,511 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); c = (Container)s.Find("from c in class ContainerX")[0]; --- 507,511 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); c = (Container)s.Find("from c in class ContainerX")[0]; *************** *** 519,523 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); c = (Container)s.Find("from c in class ContainerX")[0]; --- 519,523 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); c = (Container)s.Find("from c in class ContainerX")[0]; *************** *** 535,539 **** // twice and throw off the count by 1 (or by however many additions were // made before the flush ! s = sessions.OpenSession(); c = (Container)s.Find("from c in class ContainerX")[0]; Contained c5 = new Contained(); --- 535,539 ---- // twice and throw off the count by 1 (or by however many additions were // made before the flush ! s = OpenSession(); c = (Container)s.Find("from c in class ContainerX")[0]; Contained c5 = new Contained(); *************** *** 547,551 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); c = (Container)s.Find("from c in class ContainerX")[0]; --- 547,551 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); c = (Container)s.Find("from c in class ContainerX")[0]; *************** *** 584,588 **** public void CircularCascade() { ! ISession s = sessions.OpenSession(); ITransaction t = s.BeginTransaction(); Circular c = new Circular(); --- 584,588 ---- public void CircularCascade() { ! ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); Circular c = new Circular(); *************** *** 596,600 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); c = (Circular)s.Load( typeof(Circular), id ); --- 596,600 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); c = (Circular)s.Load( typeof(Circular), id ); *************** *** 604,608 **** c.Other.Clazz = typeof(Qux); ! s = sessions.OpenSession(); t = s.BeginTransaction(); s.SaveOrUpdate(c); --- 604,608 ---- c.Other.Clazz = typeof(Qux); ! s = OpenSession(); t = s.BeginTransaction(); s.SaveOrUpdate(c); *************** *** 611,615 **** c.Other.Other.Clazz = typeof(Bar); ! s = sessions.OpenSession(); t = s.BeginTransaction(); s.SaveOrUpdate(c); --- 611,615 ---- c.Other.Other.Clazz = typeof(Bar); ! s = OpenSession(); t = s.BeginTransaction(); s.SaveOrUpdate(c); *************** *** 617,621 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); c = (Circular)s.Load( typeof(Circular), id ); --- 617,621 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); c = (Circular)s.Load( typeof(Circular), id ); *************** *** 633,637 **** public void DeleteEmpty() { ! ISession s = sessions.OpenSession(); Assert.AreEqual( 0, s.Delete("from s in class Simple") ); Assert.AreEqual( 0, s.Delete("from o in class Universe") ); --- 633,637 ---- public void DeleteEmpty() { ! ISession s = OpenSession(); Assert.AreEqual( 0, s.Delete("from s in class Simple") ); Assert.AreEqual( 0, s.Delete("from o in class Universe") ); *************** *** 642,646 **** public void Locking() { ! ISession s = sessions.OpenSession(); ITransaction tx = s.BeginTransaction(); Simple s1 = new Simple(); --- 642,646 ---- public void Locking() { ! ISession s = OpenSession(); ITransaction tx = s.BeginTransaction(); Simple s1 = new Simple(); *************** *** 661,665 **** s.Close(); ! s = sessions.OpenSession(); tx = s.BeginTransaction(); s1 = (Simple)s.Load( typeof(Simple), (long)1, LockMode.None ); --- 661,665 ---- s.Close(); ! s = OpenSession(); tx = s.BeginTransaction(); s1 = (Simple)s.Load( typeof(Simple), (long)1, LockMode.None ); *************** *** 730,734 **** public void ObjectType() { ! ISession s = sessions.OpenSession(); Parent g = new Parent(); Foo foo = new Foo(); --- 730,734 ---- public void ObjectType() { ! ISession s = OpenSession(); Parent g = new Parent(); Foo foo = new Foo(); *************** *** 739,743 **** s.Close(); ! s = sessions.OpenSession(); g = (Parent)s.Load( typeof(Parent), g.Id ); Assert.IsNotNull( g.Any ); --- 739,743 ---- s.Close(); ! s = OpenSession(); g = (Parent)s.Load( typeof(Parent), g.Id ); Assert.IsNotNull( g.Any ); Index: FumTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/FumTest.cs,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** FumTest.cs 25 Apr 2005 13:19:07 -0000 1.20 --- FumTest.cs 5 May 2005 19:27:52 -0000 1.21 *************** *** 73,77 **** if( dialect is Dialect.MsSql2000Dialect ) return; ! using( ISession s = sessions.OpenSession() ) { Fum fum = new Fum( FumTest.FumKey("fum") ); --- 73,77 ---- if( dialect is Dialect.MsSql2000Dialect ) return; ! using( ISession s = OpenSession() ) { Fum fum = new Fum( FumTest.FumKey("fum") ); *************** *** 85,89 **** } ! using( ISession s = sessions.OpenSession() ) { Fum b = (Fum) s.CreateCriteria( typeof( Fum ) ) --- 85,89 ---- } ! using( ISession s = OpenSession() ) { Fum b = (Fum) s.CreateCriteria( typeof( Fum ) ) *************** *** 112,116 **** /* ! using( ISession s = sessions.OpenSession() ) { Fum fum = new Fum( FumKey("fum") ); --- 112,116 ---- /* ! using( ISession s = OpenSession() ) { Fum fum = new Fum( FumKey("fum") ); *************** *** 182,186 **** } ! using( ISession s = sessions.OpenSession() ) { ICriteria baseCriteria = s.CreateCriteria( typeof(Fum) ) --- 182,186 ---- } ! using( ISession s = OpenSession() ) { ICriteria baseCriteria = s.CreateCriteria( typeof(Fum) ) *************** *** 207,211 **** public void ListIdentifiers() { ! ISession s = sessions.OpenSession(); Fum fum = new Fum( FumTest.FumKey("fum") ); fum.FumString = "fo fee fi"; --- 207,211 ---- public void ListIdentifiers() { ! ISession s = OpenSession(); Fum fum = new Fum( FumTest.FumKey("fum") ); fum.FumString = "fo fee fi"; *************** *** 278,282 **** public void CompositeID() { ! ISession s = sessions.OpenSession(); ITransaction t = s.BeginTransaction(); Fum fum = new Fum( FumTest.FumKey("fum") ); --- 278,282 ---- public void CompositeID() { ! ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); Fum fum = new Fum( FumTest.FumKey("fum") ); *************** *** 289,293 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); fum = (Fum) s.Load( typeof(Fum), FumTest.FumKey("fum"), LockMode.Upgrade ); --- 289,293 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); fum = (Fum) s.Load( typeof(Fum), FumTest.FumKey("fum"), LockMode.Upgrade ); *************** *** 310,314 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); IEnumerator enumerator = s.Enumerable("from fum in class NHibernate.DomainModel.Fum where not fum.FumString='FRIEND'").GetEnumerator(); --- 310,314 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); IEnumerator enumerator = s.Enumerable("from fum in class NHibernate.DomainModel.Fum where not fum.FumString='FRIEND'").GetEnumerator(); *************** *** 331,335 **** public void CompositeIDOneToOne() { ! ISession s = sessions.OpenSession(); Fum fum = new Fum( FumKey("fum") ); fum.FumString = "fee fi fo"; --- 331,335 ---- public void CompositeIDOneToOne() { ! ISession s = OpenSession(); Fum fum = new Fum( FumKey("fum") ); fum.FumString = "fee fi fo"; *************** *** 341,345 **** s.Close(); ! s = sessions.OpenSession(); fumm = (Fumm) s.Load( typeof(Fumm), FumKey("fum") ); //s.delete(fumm.Fum); commented out in h2.0.3 --- 341,345 ---- s.Close(); ! s = OpenSession(); fumm = (Fumm) s.Load( typeof(Fumm), FumKey("fum") ); //s.delete(fumm.Fum); commented out in h2.0.3 *************** *** 353,357 **** public void CompositeIDQuery() { ! ISession s = sessions.OpenSession(); Fum fee = new Fum( FumTest.FumKey("fee", true) ); fee.FumString = "fee"; --- 353,357 ---- public void CompositeIDQuery() { ! ISession s = OpenSession(); Fum fee = new Fum( FumTest.FumKey("fee", true) ); fee.FumString = "fee"; *************** *** 370,374 **** s.Close(); ! s = sessions.OpenSession(); // Try to find the Fum object "fo" that we inserted searching by the string in the id IList vList = s.Find("from fum in class NHibernate.DomainModel.Fum where fum.Id.String='fo'"); --- 370,374 ---- s.Close(); ! s = OpenSession(); // Try to find the Fum object "fo" that we inserted searching by the string in the id IList vList = s.Find("from fum in class NHibernate.DomainModel.Fum where fum.Id.String='fo'"); *************** *** 389,393 **** s.Close(); ! s = sessions.OpenSession(); Assert.IsTrue( s.Enumerable("select fum.Id.Short, fum.Id.Date, fum.Id.String from fum in class NHibernate.DomainModel.Fum").GetEnumerator().MoveNext() ); Assert.IsTrue( s.Enumerable("select fum.Id from fum in class NHibernate.DomainModel.Fum").GetEnumerator().MoveNext() ); --- 389,393 ---- s.Close(); ! s = OpenSession(); Assert.IsTrue( s.Enumerable("select fum.Id.Short, fum.Id.Date, fum.Id.String from fum in class NHibernate.DomainModel.Fum").GetEnumerator().MoveNext() ); Assert.IsTrue( s.Enumerable("select fum.Id from fum in class NHibernate.DomainModel.Fum").GetEnumerator().MoveNext() ); *************** *** 439,443 **** public void CompositeIDCollections() { ! ISession s = sessions.OpenSession(); Fum fum1 = new Fum( FumTest.FumKey("fum1") ); Fum fum2 = new Fum( FumTest.FumKey("fum2") ); --- 439,443 ---- public void CompositeIDCollections() { ! ISession s = OpenSession(); Fum fum1 = new Fum( FumTest.FumKey("fum1") ); Fum fum2 = new Fum( FumTest.FumKey("fum2") ); *************** *** 459,463 **** s.Close(); ! s = sessions.OpenSession(); q = (Qux)s.Load( typeof(Qux), q.Key ); Assert.AreEqual( 2, q.Fums.Count, "collection of fums" ); --- 459,463 ---- s.Close(); ! s = OpenSession(); q = (Qux)s.Load( typeof(Qux), q.Key ); Assert.AreEqual( 2, q.Fums.Count, "collection of fums" ); *************** *** 477,481 **** public void DeleteOwner() { ! ISession s = sessions.OpenSession(); Qux q = new Qux(); s.Save(q); --- 477,481 ---- public void DeleteOwner() { ! ISession s = OpenSession(); Qux q = new Qux(); s.Save(q); *************** *** 497,501 **** s.Close(); ! s = sessions.OpenSession(); ITransaction t = s.BeginTransaction(); q = (Qux)s.Load( typeof(Qux), q.Key, LockMode.Upgrade ); --- 497,501 ---- s.Close(); ! s = OpenSession(); ITransaction t = s.BeginTransaction(); q = (Qux)s.Load( typeof(Qux), q.Key, LockMode.Upgrade ); *************** *** 505,509 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); list = s.Find("from fum in class NHibernate.DomainModel.Fum where not fum.FumString='FRIEND'"); --- 505,509 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); list = s.Find("from fum in class NHibernate.DomainModel.Fum where not fum.FumString='FRIEND'"); *************** *** 524,528 **** public void CompositeIDs() { ! ISession s = sessions.OpenSession(); Fo fo = Fo.NewFo(); s.Save( fo, FumTest.FumKey("an instance of fo") ); --- 524,528 ---- public void CompositeIDs() { ! ISession s = OpenSession(); Fo fo = Fo.NewFo(); s.Save( fo, FumTest.FumKey("an instance of fo") ); *************** *** 530,534 **** s.Close(); ! s = sessions.OpenSession(); fo = (Fo)s.Load( typeof(Fo), FumTest.FumKey("an instance of fo") ); fo.X = 5; --- 530,534 ---- s.Close(); ! s = OpenSession(); fo = (Fo)s.Load( typeof(Fo), FumTest.FumKey("an instance of fo") ); fo.X = 5; *************** *** 536,540 **** s.Close(); ! s = sessions.OpenSession(); fo = (Fo)s.Load( typeof(Fo), FumTest.FumKey("an instance of fo") ); Assert.AreEqual( 5, fo.X ); --- 536,540 ---- s.Close(); ! s = OpenSession(); fo = (Fo)s.Load( typeof(Fo), FumTest.FumKey("an instance of fo") ); Assert.AreEqual( 5, fo.X ); *************** *** 560,564 **** public void KeyManyToOne() { ! ISession s = sessions.OpenSession(); Inner sup = new Inner(); InnerKey sid = new InnerKey(); --- 560,564 ---- public void KeyManyToOne() { ! ISession s = OpenSession(); Inner sup = new Inner(); InnerKey sid = new InnerKey(); *************** *** 586,590 **** s.Close(); ! s = sessions.OpenSession(); d = (Outer)s.Load( typeof(Outer), did ); Assert.AreEqual( "dudu", d.Id.Master.Id.Sup.Dudu ); --- 586,590 ---- s.Close(); ! s = OpenSession(); d = (Outer)s.Load( typeof(Outer), did ); Assert.AreEqual( "dudu", d.Id.Master.Id.Sup.Dudu ); *************** *** 596,600 **** s.Close(); ! s = sessions.OpenSession(); d = (Outer)s.Find("from Outer o where o.id.DetailId=?", d.Id.DetailId, NHibernateUtil.String)[0]; s.Find("from Outer o where o.Id.Master.Id.Sup.Dudu is not null"); --- 596,600 ---- s.Close(); ! s = OpenSession(); d = (Outer)s.Find("from Outer o where o.id.DetailId=?", d.Id.DetailId, NHibernateUtil.String)[0]; s.Find("from Outer o where o.Id.Master.Id.Sup.Dudu is not null"); *************** *** 612,624 **** public void CompositeKeyPathExpressions() { ! using( ISession s = sessions.OpenSession() ) { s.Find("select fum1.Fo from fum1 in class Fum where fum1.Fo.FumString is not null"); s.Find("from fum1 in class Fum where fum1.Fo.FumString is not null order by fum1.Fo.FumString"); ! if ( !(dialect is Dialect.MySQLDialect) ! //&& !(dialect is HSQLDialect) ! //&& !(dialect is MckoiDialect) ! //&& !(dialect is PointbaseDialect) ! ) { s.Find("from fum1 in class Fum where exists elements(fum1.Friends)"); --- 612,620 ---- public void CompositeKeyPathExpressions() { ! using( ISession s = OpenSession() ) { s.Find("select fum1.Fo from fum1 in class Fum where fum1.Fo.FumString is not null"); s.Find("from fum1 in class Fum where fum1.Fo.FumString is not null order by fum1.Fo.FumString"); ! if( dialect.SupportsSubSelects ) { s.Find("from fum1 in class Fum where exists elements(fum1.Friends)"); Index: TestCase.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/TestCase.cs,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** TestCase.cs 24 Apr 2005 15:47:08 -0000 1.14 --- TestCase.cs 5 May 2005 19:27:53 -0000 1.15 *************** *** 14,24 **** namespace NHibernate.Test { ! ! public abstract class TestCase { ! private const bool OUTPUT_DDL = true; protected Configuration cfg; protected Dialect.Dialect dialect; protected ISessionFactory sessions; /// <summary> --- 14,24 ---- namespace NHibernate.Test { ! public abstract class TestCase { ! private const bool OUTPUT_DDL = false; protected Configuration cfg; protected Dialect.Dialect dialect; protected ISessionFactory sessions; + private ISession lastOpenedSession; /// <summary> *************** *** 34,38 **** --- 34,49 ---- public virtual void TearDown() { + bool wasUnclosedSession = false; + if( lastOpenedSession != null && lastOpenedSession.IsOpen ) + { + wasUnclosedSession = true; + lastOpenedSession.Close(); + } DropSchema(); + + if( wasUnclosedSession ) + { + Assert.Fail("Unclosed session"); + } } *************** *** 107,110 **** --- 118,126 ---- } + protected ISession OpenSession() + { + lastOpenedSession = sessions.OpenSession(); + return lastOpenedSession; + } } } Index: SQLLoaderTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/SQLLoaderTest.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SQLLoaderTest.cs 31 Mar 2005 12:42:39 -0000 1.3 --- SQLLoaderTest.cs 5 May 2005 19:27:52 -0000 1.4 *************** *** 60,64 **** } ! ISession session = sessions.OpenSession(); Simple sim = new Simple(); --- 60,64 ---- } ! ISession session = OpenSession(); Simple sim = new Simple(); *************** *** 81,85 **** } ! ISession session = sessions.OpenSession(); Simple sim = new Simple(); --- 81,85 ---- } ! ISession session = OpenSession(); Simple sim = new Simple(); *************** *** 97,101 **** public void FindBySQLStar() { ! ISession session = sessions.OpenSession(); Category s = new Category(); --- 97,101 ---- public void FindBySQLStar() { ! ISession session = OpenSession(); Category s = new Category(); *************** *** 129,133 **** public void FindBySQLProperties() { ! ISession session = sessions.OpenSession(); Category s = new Category(); --- 129,133 ---- public void FindBySQLProperties() { ! ISession session = OpenSession(); Category s = new Category(); *************** *** 153,157 **** public void FindBySQLAssociatedObject() { ! ISession s = sessions.OpenSession(); Category c = new Category(); --- 153,157 ---- public void FindBySQLAssociatedObject() { ! ISession s = OpenSession(); Category c = new Category(); *************** *** 167,171 **** s.Close(); ! s = sessions.OpenSession(); IList list = s.CreateSQLQuery( "select {category.*} from Category {category}", "category", typeof( Category ) ).List(); Assert.AreEqual( 1, list.Count, "Count differs" ); --- 167,171 ---- s.Close(); ! s = OpenSession(); IList list = s.CreateSQLQuery( "select {category.*} from Category {category}", "category", typeof( Category ) ).List(); Assert.AreEqual( 1, list.Count, "Count differs" ); *************** *** 180,184 **** public void FindBySQLMultipleObject() { ! ISession s = sessions.OpenSession(); Category c = new Category(); --- 180,184 ---- public void FindBySQLMultipleObject() { ! ISession s = OpenSession(); Category c = new Category(); *************** *** 210,214 **** s.Close(); ! s = sessions.OpenSession(); if ( !(dialect is Dialect.MySQLDialect) ) --- 210,214 ---- s.Close(); ! s = OpenSession(); if ( !(dialect is Dialect.MySQLDialect) ) Index: FooBarTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/FooBarTest.cs,v retrieving revision 1.96 retrieving revision 1.97 diff -C2 -d -r1.96 -r1.97 *** FooBarTest.cs 5 May 2005 13:47:41 -0000 1.96 --- FooBarTest.cs 5 May 2005 19:27:52 -0000 1.97 *************** *** 49,53 **** public void CollectionVersioning() { ! using( ISession s = sessions.OpenSession() ) { One one = new One(); --- 49,53 ---- public void CollectionVersioning() { ! using( ISession s = OpenSession() ) { [...3840 lines suppressed...] object id = s.Save( foo ); s.Flush(); s.Close(); ! s = OpenSession(); foo = (Foo)s.Find( "from Foo as f where f.id = ?", id, NHibernateUtil.String)[0]; Assert.AreEqual( 4, foo.Formula, "should be 2x 'Int' property that is defaulted to 2" ); *************** *** 5081,5085 **** public void AddAll() { ! using (ISession s = sessions.OpenSession()) { Foo foo1 = new Foo(); --- 5079,5083 ---- public void AddAll() { ! using (ISession s = OpenSession()) { Foo foo1 = new Foo(); Index: PerformanceTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/PerformanceTest.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** PerformanceTest.cs 31 Jan 2005 03:29:34 -0000 1.11 --- PerformanceTest.cs 5 May 2005 19:27:52 -0000 1.12 *************** *** 91,95 **** // allow cache to settle ! ISession s = sessions.OpenSession(); Hibernate(s, simples, ids, n, "h0"); s.Close(); --- 91,95 ---- // allow cache to settle ! ISession s = OpenSession(); Hibernate(s, simples, ids, n, "h0"); s.Close(); *************** *** 99,103 **** cp.CloseConnection(c); ! s = sessions.OpenSession(); Hibernate(s, simples, ids, n, "h0"); s.Close(); --- 99,103 ---- cp.CloseConnection(c); ! s = OpenSession(); Hibernate(s, simples, ids, n, "h0"); s.Close(); *************** *** 117,121 **** for(int i = 0; i < loops; i++) { ! using( s = sessions.OpenSession() ) { Hibernate(s, simples, ids, n, "h" + runIndex.ToString()); --- 117,121 ---- for(int i = 0; i < loops; i++) { ! using( s = OpenSession() ) { Hibernate(s, simples, ids, n, "h" + runIndex.ToString()); Index: ABCProxyTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/ABCProxyTest.cs,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** ABCProxyTest.cs 24 Apr 2005 10:14:14 -0000 1.16 --- ABCProxyTest.cs 5 May 2005 19:27:52 -0000 1.17 *************** *** 47,51 **** C2 c2; ! using( ISession s = sessions.OpenSession() ) using( ITransaction t = s.BeginTransaction() ) { --- 47,51 ---- C2 c2; ! using( ISession s = OpenSession() ) using( ITransaction t = s.BeginTransaction() ) { *************** *** 62,66 **** } ! using( ISession s = sessions.OpenSession() ) using( ITransaction t = s.BeginTransaction() ) { --- 62,66 ---- } ! using( ISession s = OpenSession() ) using( ITransaction t = s.BeginTransaction() ) { *************** *** 79,83 **** C2 c2; ! using( ISession s = sessions.OpenSession() ) using( ITransaction t = s.BeginTransaction() ) { --- 79,83 ---- C2 c2; ! using( ISession s = OpenSession() ) using( ITransaction t = s.BeginTransaction() ) { *************** *** 91,95 **** } ! using( ISession s = sessions.OpenSession() ) using( ITransaction t = s.BeginTransaction() ) { --- 91,95 ---- } ! using( ISession s = OpenSession() ) using( ITransaction t = s.BeginTransaction() ) { *************** *** 99,103 **** } ! using( ISession s = sessions.OpenSession() ) using( ITransaction t = s.BeginTransaction() ) { --- 99,103 ---- } ! using( ISession s = OpenSession() ) using( ITransaction t = s.BeginTransaction() ) { *************** *** 111,115 **** } ! using( ISession s = sessions.OpenSession() ) using( ITransaction t = s.BeginTransaction() ) { --- 111,115 ---- } ! using( ISession s = OpenSession() ) using( ITransaction t = s.BeginTransaction() ) { *************** *** 123,127 **** } ! using( ISession s = sessions.OpenSession() ) using( ITransaction t = s.BeginTransaction() ) { --- 123,127 ---- } ! using( ISession s = OpenSession() ) using( ITransaction t = s.BeginTransaction() ) { *************** *** 135,139 **** public void Subclassing() { ! ISession s = sessions.OpenSession(); ITransaction t = s.BeginTransaction(); C1 c1 = new C1(); --- 135,139 ---- public void Subclassing() { ! ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); C1 c1 = new C1(); *************** *** 150,154 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); // Test won't run after this line because of proxy initalization problems --- 150,154 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); // Test won't run after this line because of proxy initalization problems *************** *** 159,163 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); B c1b = (B) s.Load( typeof(B), c1.Id ); --- 159,163 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); B c1b = (B) s.Load( typeof(B), c1.Id ); *************** *** 169,173 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); c1 = (C1) s.Load( typeof(C1), c1.Id ); --- 169,173 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); c1 = (C1) s.Load( typeof(C1), c1.Id ); *************** *** 181,185 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); c1a = (A) s.Load( typeof(A), c1.Id ); --- 181,185 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); c1a = (A) s.Load( typeof(A), c1.Id ); *************** *** 201,205 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); c1a = (A) s.Load( typeof(A), c1.Id ); --- 201,205 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); c1a = (A) s.Load( typeof(A), c1.Id ); *************** *** 221,225 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); c1a = (A) s.Load( typeof(A), c1.Id ); --- 221,225 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); c1a = (A) s.Load( typeof(A), c1.Id ); *************** *** 241,245 **** s.Close(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); s.Save( new B() ); --- 241,245 ---- s.Close(); ! s = OpenSession(); t = s.BeginTransaction(); s.Save( new B() ); *************** *** 257,261 **** { //Test is converted, but the original didn't check anything ! ISession s = sessions.OpenSession(); ITransaction t = s.BeginTransaction(); B b = new B(); --- 257,261 ---- { //Test is converted, but the original didn't check anything ! ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); B b = new B(); *************** *** 268,272 **** t.Commit(); ! s = sessions.OpenSession(); t = s.BeginTransaction(); map = new Hashtable(); --- 268,272 ---- t.Commit(); ! s = OpenSession(); t = s.BeginTransaction(); map = new Hashtable(); *************** *** 295,299 **** object d2id; ! using( ISession s = sessions.OpenSession() ) using( ITransaction t = s.BeginTransaction() ) { --- 295,299 ---- object d2id; ! using( ISession s = OpenSession() ) using( ITransaction t = s.BeginTransaction() ) { *************** *** 303,307 **** } ! using( ISession s = sessions.OpenSession() ) using( ITransaction t = s.BeginTransaction() ) { --- 303,307 ---- } ! using( ISession s = OpenSession() ) using( ITransaction t = s.BeginTransaction() ) { *************** *** 313,317 **** } ! using( ISession s = sessions.OpenSession() ) using( ITransaction t = s.BeginTransaction() ) { --- 313,317 ---- } ! using( ISession s = OpenSession() ) using( ITransaction t = s.BeginTransaction() ) { *************** *** 325,329 **** } ! using( ISession s = sessions.OpenSession() ) using( ITransaction t = s.BeginTransaction() ) { --- 325,329 ---- } ! using( ISession s = OpenSession() ) using( ITransaction t = s.BeginTransaction() ) { *************** *** 339,343 **** } ! using( ISession s = sessions.OpenSession() ) using( ITransaction t = s.BeginTransaction() ) { --- 339,343 ---- } ! using( ISession s = OpenSession() ) using( ITransaction t = s.BeginTransaction() ) { Index: AssemblyInfo.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/AssemblyInfo.cs,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** AssemblyInfo.cs 17 Apr 2005 17:16:04 -0000 1.13 --- AssemblyInfo.cs 5 May 2005 19:27:52 -0000 1.14 *************** *** 5,9 **** // <autogenerated> // This code was generated by a tool. ! // Runtime Version: 1.1.4322.573 // // Changes to this file may cause incorrect behavior and will be lost if --- 5,9 ---- // <autogenerated> // This code was generated by a tool. ! // Runtime Version: 1.1.4322.2032 // // Changes to this file may cause incorrect behavior and will be lost if Index: MasterDetailTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/MasterDetailTest.cs,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** MasterDetailTest.cs 30 Mar 2005 16:28:11 -0000 1.21 --- MasterDetailTest.cs 5 May 2005 19:27:52 -0000 1.22 *************** *** 34,38 **** public void ParentChildren() { ! ISession s = sessions.OpenSession(); //M parent = new M --- 34,38 ---- public void ParentChildren() { ! ISession s = OpenSession(); //M parent = new M *************** *** 65,69 **** cat.Subcategories.Add( subCatBaz ); ! ISession s = sessions.OpenSession(); s.Save( catWA ); s.Save( cat ); --- 65,69 ---- cat.Subcategories.Add( subCatBaz ); ! ISession s = OpenSession(); s.Save( catWA ); s.Save( cat ); *************** *** 81,90 **** newCat.Subcategories.Add( newSubCat ); ! s = sessions.OpenSession(); s.SaveOrUpdateCopy( cat ); s.Flush(); s.Close(); ! s = sessions.OpenSession(); cat = (Category) s.CreateQuery( "from Category cat where cat.Name='new foo'").UniqueResult(); newSubCat = (Category) s.CreateQuery( "from Category cat where cat.Name='new sub'").UniqueResult(); --- 81,90 ---- newCat.Subcategories.Add( newSubCat ); ! s = OpenSession(); s.SaveOrUpdateCopy( cat ); s.Flush(); ... [truncated message content] |