From: <fab...@us...> - 2009-02-03 16:22:55
|
Revision: 4021 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4021&view=rev Author: fabiomaulo Date: 2009-02-03 16:22:49 +0000 (Tue, 03 Feb 2009) Log Message: ----------- Ignoring test (Multi-query) Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1609/Fixture.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1609/Mappings.hbm.xml Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1609/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1609/Fixture.cs 2009-02-03 16:11:00 UTC (rev 4020) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1609/Fixture.cs 2009-02-03 16:22:49 UTC (rev 4021) @@ -1,74 +1,76 @@ using System.Collections; - using NHibernate.Criterion; -using NHibernate.Test.NHSpecificTest.NH1609; - +using NHibernate.Driver; using NUnit.Framework; namespace NHibernate.Test.NHSpecificTest.NH1609 { - [TestFixture] - public class Fixture : BugTestCase - { - [Test] - public void Test() - { - using (ISession session = sessions.OpenSession()) - using (ITransaction transaction = session.BeginTransaction()) - { - EntityA a1 = CreateEntityA(session); - EntityA a2 = CreateEntityA(session); - EntityC c = CreateEntityC(session); - EntityB b = CreateEntityB(session, a1, c); + [TestFixture] + public class Fixture : BugTestCase + { + [Test] + public void Test() + { + IDriver driver = sessions.ConnectionProvider.Driver; + if (!driver.SupportsMultipleQueries) + { + Assert.Ignore("Driver {0} does not support multi-queries", driver.GetType().FullName); + } + using (ISession session = sessions.OpenSession()) + { + using (ITransaction transaction = session.BeginTransaction()) + { + EntityA a1 = CreateEntityA(session); + EntityA a2 = CreateEntityA(session); + EntityC c = CreateEntityC(session); + EntityB b = CreateEntityB(session, a1, c); - // make sure the created entities are no longer in the session - session.Clear(); + // make sure the created entities are no longer in the session + session.Clear(); - IMultiCriteria multi = session.CreateMultiCriteria(); + IMultiCriteria multi = session.CreateMultiCriteria(); - // the first query is a simple select by id on EntityA - multi.Add(session.CreateCriteria(typeof(EntityA)).Add(Restrictions.Eq("Id", a1.Id))); - // the second query is also a simple select by id on EntityB - multi.Add(session.CreateCriteria(typeof(EntityA)).Add(Restrictions.Eq("Id", a2.Id))); - // the final query selects the first element (using SetFirstResult and SetMaxResults) for each EntityB where B.A.Id = a1.Id and B.C.Id = c.Id - // the problem is that the paged query uses parameters @p0 and @p1 instead of @p2 and @p3 - multi.Add( - session.CreateCriteria(typeof(EntityB)) - .Add(Restrictions.Eq("A.Id", a1.Id)) - .Add(Restrictions.Eq("C.Id", c.Id)) - .SetFirstResult(0) - .SetMaxResults(1)); + // the first query is a simple select by id on EntityA + multi.Add(session.CreateCriteria(typeof (EntityA)).Add(Restrictions.Eq("Id", a1.Id))); + // the second query is also a simple select by id on EntityB + multi.Add(session.CreateCriteria(typeof (EntityA)).Add(Restrictions.Eq("Id", a2.Id))); + // the final query selects the first element (using SetFirstResult and SetMaxResults) for each EntityB where B.A.Id = a1.Id and B.C.Id = c.Id + // the problem is that the paged query uses parameters @p0 and @p1 instead of @p2 and @p3 + multi.Add( + session.CreateCriteria(typeof (EntityB)).Add(Restrictions.Eq("A.Id", a1.Id)).Add(Restrictions.Eq("C.Id", c.Id)). + SetFirstResult(0).SetMaxResults(1)); - var results = multi.List(); + IList results = multi.List(); - Assert.AreEqual(1, ((IList)results[0]).Count); - Assert.AreEqual(1, ((IList)results[1]).Count); - Assert.AreEqual(1, ((IList)results[2]).Count); - } - } + Assert.AreEqual(1, ((IList) results[0]).Count); + Assert.AreEqual(1, ((IList) results[1]).Count); + Assert.AreEqual(1, ((IList) results[2]).Count); + } + } + } - private EntityA CreateEntityA(ISession session) - { - EntityA a = new EntityA(); - session.Save(a); - session.Flush(); - return a; - } + private EntityA CreateEntityA(ISession session) + { + var a = new EntityA(); + session.Save(a); + session.Flush(); + return a; + } - private EntityC CreateEntityC(ISession session) - { - EntityC c = new EntityC(); - session.Save(c); - session.Flush(); - return c; - } + private EntityC CreateEntityC(ISession session) + { + var c = new EntityC(); + session.Save(c); + session.Flush(); + return c; + } - private EntityB CreateEntityB(ISession session, EntityA a, EntityC c) - { - EntityB b = new EntityB { A = a, C = c }; - session.Save(b); - session.Flush(); - return b; - } - } -} + private EntityB CreateEntityB(ISession session, EntityA a, EntityC c) + { + var b = new EntityB {A = a, C = c}; + session.Save(b); + session.Flush(); + return b; + } + } +} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1609/Mappings.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1609/Mappings.hbm.xml 2009-02-03 16:11:00 UTC (rev 4020) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1609/Mappings.hbm.xml 2009-02-03 16:22:49 UTC (rev 4021) @@ -5,13 +5,13 @@ <class name="EntityA" table="EntityA"> <id name="Id" column="Id" type="long"> - <generator class="identity"/> + <generator class="native"/> </id> </class> <class name="EntityB" table="EntityB"> <id name="Id" column="Id" type="long"> - <generator class="identity"/> + <generator class="native"/> </id> <many-to-one name="A" column="AId" class="EntityA" /> @@ -21,7 +21,7 @@ <class name="EntityC" table="EntityC"> <id name="Id" column="Id" type="long"> - <generator class="identity" /> + <generator class="native" /> </id> </class> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |