From: <aye...@us...> - 2009-06-28 14:54:20
|
Revision: 4539 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4539&view=rev Author: ayenderahien Date: 2009-06-28 13:56:34 +0000 (Sun, 28 Jun 2009) Log Message: ----------- Merging from 2.1.x - partial commit More fixes for NH 1850 Will now also report timing for batched statements execution Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1850/Fixture.cs Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1850/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1850/Fixture.cs 2009-06-28 12:19:32 UTC (rev 4538) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1850/Fixture.cs 2009-06-28 13:56:34 UTC (rev 4539) @@ -1,16 +1,19 @@ -using System; -using System.Collections.Generic; -using System.Text; -using NHibernate.Criterion; -using NUnit.Framework; +using NUnit.Framework; namespace NHibernate.Test.NHSpecificTest.NH1850 { + using System; using AdoNet; + using Environment=NHibernate.Cfg.Environment; [TestFixture] public class Fixture:BugTestCase { + protected override void Configure(NHibernate.Cfg.Configuration configuration) + { + configuration.SetProperty(Environment.BatchSize, "1"); + } + [Test] public void CanGetQueryDurationForDelete() { @@ -30,6 +33,38 @@ } [Test] + public void CanGetQueryDurationForBatch() + { + using (LogSpy spy = new LogSpy(typeof(AbstractBatcher))) + using (ISession session = OpenSession()) + using (ITransaction tx = session.BeginTransaction()) + { + for (int i = 0; i < 3; i++) + { + var customer = new Customer + { + Name = "foo" + }; + session.Save(customer); + session.Delete(customer); + } + session.Flush(); + + var wholeLog = spy.GetWholeLog(); + var lines = wholeLog.Split(new[]{System.Environment.NewLine},StringSplitOptions.RemoveEmptyEntries); + int batches = 0; + foreach (var line in lines) + { + if (line.Contains("ExecuteBatch for 1 statements took ")) + batches += 1; + } + Assert.AreEqual(3, batches); + + tx.Rollback(); + } + } + + [Test] public void CanGetQueryDurationForSelect() { using (LogSpy spy = new LogSpy(typeof(AbstractBatcher))) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |