Skip to content

Adjust code according to review #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/NHibernate.Config.Templates/HANA.cfg.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ for your own use before compile tests in VisualStudio.
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
<session-factory name="NHibernate.Test">
<property name="connection.driver_class">NHibernate.Driver.HanaDriver</property>
<!-- Sap.Data.Hana does not support re-enlisting in the same transaction, wrecking many usages
with NHibernate when both NHibernate and the connection performs auto-enlistment. -->
<property name="connection.connection_string">
Server=localhost:39015;UserID=nhibernate;Password=
Server=localhost:39015;UserID=nhibernate;Password=;
Enlist=false;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the way to fix most transaction scope tests failures in my opinion. So this needs to be adjusted in any previously existing test configuration.

</property>
<property name="dialect">NHibernate.Dialect.HanaColumnStoreDialect</property>
</session-factory>
Expand Down
2 changes: 1 addition & 1 deletion src/NHibernate.Test/Ado/GenericBatchingBatcherFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected override bool AppliesTo(Dialect.Dialect dialect)
return !(dialect is FirebirdDialect) &&
!(dialect is Oracle8iDialect) &&
!(dialect is MsSqlCeDialect) &&
!(dialect is AbstractHanaDialect);
!(dialect is HanaDialectBase);
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected override bool AppliesTo(Dialect.Dialect dialect)
return !(dialect is FirebirdDialect) &&
!(dialect is Oracle8iDialect) &&
!(dialect is MsSqlCeDialect) &&
!(dialect is AbstractHanaDialect);
!(dialect is HanaDialectBase);
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ namespace NHibernate.Test.Criteria.Lambda
[TestFixture]
public class FunctionsIntegrationFixtureAsync : TestCase
{
protected override bool AppliesTo(Dialect.Dialect dialect)
{
return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator;
}

protected override string MappingsAssembly => "NHibernate.Test";

protected override IList Mappings => new[] { "Criteria.Lambda.Mappings.hbm.xml" };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ namespace NHibernate.Test.Criteria.Lambda
[TestFixture]
public class IntegrationFixtureAsync : TestCase
{
protected override bool AppliesTo(Dialect.Dialect dialect)
{
return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator;
}

protected override string MappingsAssembly { get { return "NHibernate.Test"; } }

protected override IList Mappings
Expand Down Expand Up @@ -269,6 +264,9 @@ public async Task IsTypeAsync()
[Test]
public async Task OverrideEagerJoinAsync()
{
if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator)
Assert.Ignore("Support of empty inserts is required");

using (ISession s = OpenSession())
using (ITransaction t = s.BeginTransaction())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ namespace NHibernate.Test.Criteria.Lambda
[TestFixture]
public class ProjectIntegrationFixtureAsync : TestCase
{
protected override bool AppliesTo(Dialect.Dialect dialect)
{
return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator;
}

protected override string MappingsAssembly
{
get { return "NHibernate.Test"; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ namespace NHibernate.Test.Criteria.Lambda
[TestFixture]
public class SimpleIntegrationFixtureAsync : TestCase
{
protected override bool AppliesTo(Dialect.Dialect dialect)
{
return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator;
}

protected override string MappingsAssembly
{
get { return "NHibernate.Test"; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ namespace NHibernate.Test.Criteria.Lambda
[TestFixture]
public class SubQueryIntegrationFixtureAsync : TestCase
{
protected override bool AppliesTo(Dialect.Dialect dialect)
{
return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator;
}

protected override string MappingsAssembly
{
get { return "NHibernate.Test"; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected override string MappingsAssembly

protected override bool AppliesTo(Dialect.Dialect dialect)
{
return dialect.SupportsSequences && !(dialect is Dialect.MsSql2012Dialect) && !(dialect is Dialect.AbstractHanaDialect);
return dialect.SupportsSequences && !(dialect is Dialect.MsSql2012Dialect) && !(dialect is Dialect.HanaDialectBase);
}

[Test]
Expand Down
9 changes: 4 additions & 5 deletions src/NHibernate.Test/Async/GenericTest/Overall/Fixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using System;
using System.Collections;
using System.Collections.Generic;

using NUnit.Framework;

namespace NHibernate.Test.GenericTest.Overall
Expand All @@ -19,11 +20,6 @@ namespace NHibernate.Test.GenericTest.Overall
[TestFixture]
public class FixtureAsync : TestCase
{
protected override bool AppliesTo(Dialect.Dialect dialect)
{
return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator;
}

protected override IList Mappings
{
get { return new[] { "GenericTest.Overall.Mappings.hbm.xml" }; }
Expand Down Expand Up @@ -57,6 +53,9 @@ public async Task CRUDAsync()
[Test]
public async Task CRUDABAsync()
{
if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator)
Assert.Ignore("Support of empty inserts is required");

var entity = new A<B>
{
Property = new B { Prop = 2 },
Expand Down
2 changes: 1 addition & 1 deletion src/NHibernate.Test/Async/Hql/HQLFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@ public async Task CastAsync()
throw;
}
}
else if (Dialect is AbstractHanaDialect)
else if (Dialect is HanaDialectBase)
{
string msgToCheck =
"not a GROUP BY expression: 'ANIMAL0_.BODYWEIGHT' must be in group by clause";
Expand Down
6 changes: 0 additions & 6 deletions src/NHibernate.Test/Async/Legacy/FooBarTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
using NHibernate.Dialect;
using NHibernate.DomainModel;
using NHibernate.Criterion;
using NHibernate.Id;
using NHibernate.Proxy;
using NHibernate.Type;
using NHibernate.Util;
Expand All @@ -43,11 +42,6 @@ private static byte[] GetBytes(string str)
return Encoding.Unicode.GetBytes(str);
}

protected override bool AppliesTo(Dialect.Dialect dialect)
{
return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator;
}

protected override IList Mappings
{
get
Expand Down
5 changes: 0 additions & 5 deletions src/NHibernate.Test/Async/Legacy/FumTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ public class FumTestAsync : TestCase
{
protected static short fumKeyShort = 1;

protected override bool AppliesTo(Dialect.Dialect dialect)
{
return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator;
}

protected override IList Mappings
{
get
Expand Down
29 changes: 24 additions & 5 deletions src/NHibernate.Test/Async/Legacy/MasterDetailTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ namespace NHibernate.Test.Legacy
[TestFixture]
public class MasterDetailTestAsync : TestCase
{
protected override bool AppliesTo(Dialect.Dialect dialect)
{
return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator;
}

protected override IList Mappings
{
get
Expand All @@ -57,6 +52,9 @@ protected override IList Mappings
[Test]
public async Task ParentChildrenAsync()
{
if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator)
Assert.Ignore("Support of empty inserts is required");

ISession session = OpenSession();

M parent = new M();
Expand Down Expand Up @@ -847,6 +845,9 @@ public async Task MixNativeAssignedAsync()
[Test]
public async Task CollectionReplaceOnUpdateAsync()
{
if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator)
Assert.Ignore("Support of empty inserts is required");

ISession s = OpenSession();
ITransaction t = s.BeginTransaction();
Category c = new Category();
Expand Down Expand Up @@ -892,6 +893,9 @@ public async Task CollectionReplaceOnUpdateAsync()
[Test]
public async Task CollectionReplace2Async()
{
if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator)
Assert.Ignore("Support of empty inserts is required");

ISession s = OpenSession();
ITransaction t = s.BeginTransaction();
Category c = new Category();
Expand Down Expand Up @@ -931,6 +935,9 @@ public async Task CollectionReplace2Async()
[Test]
public async Task CollectionReplaceAsync()
{
if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator)
Assert.Ignore("Support of empty inserts is required");

ISession s = OpenSession();
ITransaction t = s.BeginTransaction();
Category c = new Category();
Expand Down Expand Up @@ -976,6 +983,9 @@ public async Task CollectionReplaceAsync()
[Test]
public async Task CategoriesAsync()
{
if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator)
Assert.Ignore("Support of empty inserts is required");

Category c = new Category();
c.Name = Category.RootCategory;
Category c1 = new Category();
Expand Down Expand Up @@ -1017,6 +1027,9 @@ public async Task CategoriesAsync()
[Test]
public async Task CollectionRefreshAsync()
{
if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator)
Assert.Ignore("Support of empty inserts is required");

ISession s = OpenSession();
Category c = new Category();
IList<Category> list = new List<Category>();
Expand Down Expand Up @@ -1060,6 +1073,9 @@ public async Task CollectionRefreshAsync()
[Test]
public async Task CachedCollectionRefreshAsync()
{
if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator)
Assert.Ignore("Support of empty inserts is required");

ISession s = OpenSession();
Category c = new Category();
IList<Category> list = new List<Category>();
Expand Down Expand Up @@ -1245,6 +1261,9 @@ public async Task QueuedBagAddsAsync()
[Test]
public async Task PolymorphicCriteriaAsync()
{
if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator)
Assert.Ignore("Support of empty inserts is required");

ISession s = OpenSession();
ITransaction txn = s.BeginTransaction();
Category f = new Category();
Expand Down
31 changes: 9 additions & 22 deletions src/NHibernate.Test/Async/Legacy/MultiTableTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
using System.Collections.Generic;
using NHibernate.Dialect;
using NHibernate.DomainModel;
using NHibernate.Id;
using NUnit.Framework;

namespace NHibernate.Test.Legacy
Expand Down Expand Up @@ -149,7 +148,7 @@ public async Task QueriesAsync()
ISession s = OpenSession();
long id = 1L;

if (Dialect is MsSql2000Dialect || Dialect is AbstractHanaDialect)
if (TestDialect.HasIdentityNativeGenerator)
{
id = (long) await (s.SaveAsync(new TrivialClass()));
}
Expand Down Expand Up @@ -185,7 +184,7 @@ public async Task ConstraintsAsync()
ITransaction t = s.BeginTransaction();
SubMulti sm = new SubMulti();
sm.Amount = 66.5f;
if (Dialect is MsSql2000Dialect || Dialect is AbstractHanaDialect)
if (TestDialect.HasIdentityNativeGenerator)
{
await (s.SaveAsync(sm));
}
Expand All @@ -206,11 +205,6 @@ public async Task ConstraintsAsync()
[Test]
public async Task MultiTableAsync()
{
if (Dialect is AbstractHanaDialect)
{
Assert.Ignore("feature not supported: Currently specify table name by 'FOR UPDATE of t1.c1' if there are more than one tables/views/subqueries in the FROM clause");
}

ISession s = OpenSession();
ITransaction t = s.BeginTransaction();
Multi multi = new Multi();
Expand All @@ -221,7 +215,7 @@ public async Task MultiTableAsync()
simp.Name = "simp";
object mid;
object sid;
if (Dialect is MsSql2000Dialect || Dialect is AbstractHanaDialect)
if (TestDialect.HasIdentityNativeGenerator)
{
mid = await (s.SaveAsync(multi));
sid = await (s.SaveAsync(simp));
Expand All @@ -236,7 +230,7 @@ public async Task MultiTableAsync()
SubMulti sm = new SubMulti();
sm.Amount = 66.5f;
object smid;
if (Dialect is MsSql2000Dialect || Dialect is AbstractHanaDialect)
if (TestDialect.HasIdentityNativeGenerator)
{
smid = await (s.SaveAsync(sm));
}
Expand Down Expand Up @@ -346,11 +340,6 @@ public async Task MultiTableAsync()
[Test]
public async Task MultiTableGeneratedIdAsync()
{
if (Dialect is AbstractHanaDialect)
{
Assert.Ignore("feature not supported: Currently specify table name by 'FOR UPDATE of t1.c1' if there are more than one tables/views/subqueries in the FROM clause");
}

ISession s = OpenSession();
ITransaction t = s.BeginTransaction();
Multi multi = new Multi();
Expand Down Expand Up @@ -475,7 +464,7 @@ public async Task MultiTableCollectionsAsync()
simp.Name = "simp";
object mid;
object sid;
if (Dialect is MsSql2000Dialect || Dialect is AbstractHanaDialect)
if (TestDialect.HasIdentityNativeGenerator)
{
mid = await (s.SaveAsync(multi));
sid = await (s.SaveAsync(simp));
Expand All @@ -495,7 +484,7 @@ public async Task MultiTableCollectionsAsync()
ls.Set = new HashSet<Top> { multi, simp };

object id;
if (Dialect is MsSql2000Dialect || Dialect is AbstractHanaDialect)
if (TestDialect.HasIdentityNativeGenerator)
{
id = await (s.SaveAsync(ls));
}
Expand Down Expand Up @@ -552,7 +541,7 @@ public async Task MultiTableManyToOneAsync()
simp.Name = "simp";
object mid;

if (Dialect is MsSql2000Dialect || Dialect is AbstractHanaDialect)
if (TestDialect.HasIdentityNativeGenerator)
{
mid = await (s.SaveAsync(multi));
}
Expand All @@ -567,7 +556,7 @@ public async Task MultiTableManyToOneAsync()
ls.YetAnother = ls;
ls.Name = "Less Simple";
object id;
if (Dialect is MsSql2000Dialect || Dialect is AbstractHanaDialect)
if (TestDialect.HasIdentityNativeGenerator)
{
id = await (s.SaveAsync(ls));
}
Expand Down Expand Up @@ -614,9 +603,7 @@ public async Task MultiTableNativeIdAsync()
public async Task CollectionAsync()
{
if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator)
{
Assert.Ignore("Empty inserts are not supported by the current dialect.");
}
Assert.Ignore("Support of empty inserts is required");

ISession s = OpenSession();
ITransaction t = s.BeginTransaction();
Expand Down
Loading