|
From: <pa...@us...> - 2011-03-13 23:01:03
|
Revision: 5468
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5468&view=rev
Author: patearl
Date: 2011-03-13 23:00:55 +0000 (Sun, 13 Mar 2011)
Log Message:
-----------
Tests: Improved support for SQLite in some tests.
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/DtcFailures/DtcFailuresFixture.cs
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1632/Fixture.cs
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1792/Fixture.cs
trunk/nhibernate/src/NHibernate.Test/TestDialect.cs
trunk/nhibernate/src/NHibernate.Test/TestDialects/SQLiteTestDialect.cs
Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/DtcFailures/DtcFailuresFixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/DtcFailures/DtcFailuresFixture.cs 2011-03-13 04:56:18 UTC (rev 5467)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/DtcFailures/DtcFailuresFixture.cs 2011-03-13 23:00:55 UTC (rev 5468)
@@ -23,6 +23,11 @@
get { return "NHibernate.Test"; }
}
+ protected override bool AppliesTo(Dialect.Dialect dialect)
+ {
+ return TestDialect.GetTestDialect(dialect).SupportsDistributedTransactions;
+ }
+
[Test]
public void WillNotCrashOnDtcPrepareFailure()
{
Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1632/Fixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1632/Fixture.cs 2011-03-13 04:56:18 UTC (rev 5467)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1632/Fixture.cs 2011-03-13 23:00:55 UTC (rev 5468)
@@ -31,7 +31,7 @@
using (var session = sessions.OpenSession())
using (var command = session.Connection.CreateCommand())
{
- command.CommandText = "select next_hi from hibernate_unique_key with (updlock, rowlock)";
+ command.CommandText = "select next_hi from hibernate_unique_key";
scalar1 = command.ExecuteScalar();
}
@@ -52,7 +52,7 @@
using (var session = sessions.OpenSession())
using (var command = session.Connection.CreateCommand())
{
- command.CommandText = "select next_hi from hibernate_unique_key with (updlock, rowlock)";
+ command.CommandText = "select next_hi from hibernate_unique_key";
scalar2 = command.ExecuteScalar();
}
@@ -174,6 +174,9 @@
[Test]
public void When_using_two_sessions_with_explicit_flush()
{
+ if (!TestDialect.SupportsConcurrentTransactions)
+ Assert.Ignore(Dialect.GetType().Name + " does not support concurrent transactions.");
+
object id1, id2;
using (var tx = new TransactionScope())
{
@@ -209,6 +212,9 @@
[Test]
public void When_using_two_sessions()
{
+ if (!TestDialect.SupportsConcurrentTransactions)
+ Assert.Ignore(Dialect.GetType().Name + " does not support concurrent transactions.");
+
object id1, id2;
using (var tx = new TransactionScope())
{
Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1792/Fixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1792/Fixture.cs 2011-03-13 04:56:18 UTC (rev 5467)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1792/Fixture.cs 2011-03-13 23:00:55 UTC (rev 5468)
@@ -81,7 +81,7 @@
{
IList<Product> results =
session.CreateCriteria<Product>().Add(
- Expression.Sql("{alias}.Id in (Select top 5 p.Id from Product p order by Name)")).Add(Restrictions.Gt("Id", 0)).
+ Expression.Sql("{alias}.Id in (Select p.Id from Product p order by Name)")).Add(Restrictions.Gt("Id", 0)).
SetMaxResults(3).List<Product>();
Assert.AreEqual(3, results.Count);
Modified: trunk/nhibernate/src/NHibernate.Test/TestDialect.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/TestDialect.cs 2011-03-13 04:56:18 UTC (rev 5467)
+++ trunk/nhibernate/src/NHibernate.Test/TestDialect.cs 2011-03-13 23:00:55 UTC (rev 5468)
@@ -24,5 +24,14 @@
public virtual bool SupportsOperatorAll { get { return true; } }
public virtual bool SupportsOperatorSome { get { return true; } }
public virtual bool SupportsLocate { get { return true; } }
+
+ public virtual bool SupportsDistributedTransactions { get { return true; } }
+
+ /// <summary>
+ /// Whether two transactions can be run at the same time. For example, with SQLite
+ /// the database is locked when one transaction is run, so running a second transaction
+ /// will cause a "database is locked" error message.
+ /// </summary>
+ public virtual bool SupportsConcurrentTransactions { get { return true; } }
}
}
Modified: trunk/nhibernate/src/NHibernate.Test/TestDialects/SQLiteTestDialect.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/TestDialects/SQLiteTestDialect.cs 2011-03-13 04:56:18 UTC (rev 5467)
+++ trunk/nhibernate/src/NHibernate.Test/TestDialects/SQLiteTestDialect.cs 2011-03-13 23:00:55 UTC (rev 5468)
@@ -21,5 +21,15 @@
{
get { return false; }
}
+
+ public override bool SupportsDistributedTransactions
+ {
+ get { return false; }
+ }
+
+ public override bool SupportsConcurrentTransactions
+ {
+ get { return false; }
+ }
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|