Skip to content

Commit 9b27dd8

Browse files
Merge branch 'master' into GH-1381
2 parents 79d6362 + 1ebebd5 commit 9b27dd8

File tree

180 files changed

+3854
-888
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

180 files changed

+3854
-888
lines changed

ShowBuildMenu.bat

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,14 @@ echo E. Add a test configuration for Oracle.
5151
echo F. Add a test configuration for Oracle with managed driver.
5252
echo G. Add a test configuration for SQL Server Compact.
5353
echo H. Add a test configuration for MySql.
54+
echo I. Add a test configuration for SAP HANA.
5455
echo.
5556
echo X. Exit to main menu.
5657
echo.
5758

58-
%BUILDTOOL% prompt ABCDEFGHX
59-
if errorlevel 8 goto main-menu
59+
%BUILDTOOL% prompt ABCDEFGHIX
60+
if errorlevel 9 goto main-menu
61+
if errorlevel 8 goto test-setup-hana
6062
if errorlevel 7 goto test-setup-mysql
6163
if errorlevel 6 goto test-setup-sqlserverce
6264
if errorlevel 5 goto test-setup-oracle-managed
@@ -122,6 +124,13 @@ set LIB_FILES=
122124
set LIB_FILES2=
123125
goto test-setup-generic
124126

127+
:test-setup-hana
128+
set CONFIG_NAME=HANA
129+
set TEST_PLATFORM=AnyCPU
130+
set LIB_FILES=
131+
set LIB_FILES2=
132+
goto test-setup-generic
133+
125134
:test-setup-generic
126135
set CFGNAME=
127136
set /p CFGNAME=Enter a name for your test configuration or press enter to use default name:
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
This template was written to work with NHibernate.Test.
4+
Copy the template to your NHibernate.Test project folder and rename it in hibernate.cfg.xml and change it
5+
for your own use before compile tests in VisualStudio.
6+
-->
7+
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
8+
<session-factory name="NHibernate.Test">
9+
<property name="connection.driver_class">NHibernate.Driver.HanaColumnStoreDriver</property>
10+
<!-- Sap.Data.Hana does not support re-enlisting in the same transaction, wrecking many usages
11+
with NHibernate when both NHibernate and the connection performs auto-enlistment. -->
12+
<property name="connection.connection_string">
13+
Server=localhost:39015;UserID=nhibernate;Password=;
14+
Enlist=false;
15+
</property>
16+
<property name="dialect">NHibernate.Dialect.HanaColumnStoreDialect</property>
17+
</session-factory>
18+
</hibernate-configuration>

src/NHibernate.Test/Ado/GenericBatchingBatcherFixture.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ protected override bool AppliesTo(Dialect.Dialect dialect)
2828
{
2929
return !(dialect is FirebirdDialect) &&
3030
!(dialect is Oracle8iDialect) &&
31-
!(dialect is MsSqlCeDialect);
31+
!(dialect is MsSqlCeDialect) &&
32+
!(dialect is HanaDialectBase);
3233
}
3334

3435
[Test]

src/NHibernate.Test/Async/Ado/GenericBatchingBatcherFixture.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ protected override bool AppliesTo(Dialect.Dialect dialect)
4141
{
4242
return !(dialect is FirebirdDialect) &&
4343
!(dialect is Oracle8iDialect) &&
44-
!(dialect is MsSqlCeDialect);
44+
!(dialect is MsSqlCeDialect) &&
45+
!(dialect is HanaDialectBase);
4546
}
4647

4748
[Test]

src/NHibernate.Test/Async/Criteria/Lambda/IntegrationFixture.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,9 @@ public async Task IsTypeAsync()
264264
[Test]
265265
public async Task OverrideEagerJoinAsync()
266266
{
267+
if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator)
268+
Assert.Ignore("Support of empty inserts is required");
269+
267270
using (ISession s = OpenSession())
268271
using (ITransaction t = s.BeginTransaction())
269272
{
@@ -455,4 +458,4 @@ public async Task StatelessSessionAsync()
455458
}
456459
}
457460
}
458-
}
461+
}

src/NHibernate.Test/Async/Events/Collections/AbstractCollectionEventFixture.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
using System.Collections.Generic;
1313
using NHibernate.Collection;
1414
using NHibernate.Collection.Generic;
15-
using NHibernate.Event;
1615
using NHibernate.Test.Events.Collections.Association.Bidirectional.ManyToMany;
1716
using NUnit.Framework;
1817

@@ -23,6 +22,11 @@ namespace NHibernate.Test.Events.Collections
2322
[TestFixture]
2423
public abstract class AbstractCollectionEventFixtureAsync : TestCase
2524
{
25+
protected override bool AppliesTo(Dialect.Dialect dialect)
26+
{
27+
return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator;
28+
}
29+
2630
protected override string MappingsAssembly
2731
{
2832
get { return "NHibernate.Test"; }

src/NHibernate.Test/Async/Futures/FallbackFixture.cs

Lines changed: 77 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ protected override void OnTearDown()
5858
{
5959
using (var session = Sfi.OpenSession())
6060
{
61-
session.Delete("from Person");
62-
session.Flush();
61+
session.CreateQuery("delete from System.Object").ExecuteUpdate();
6362
}
6463

6564
base.OnTearDown();
@@ -179,6 +178,82 @@ public async Task FutureValueWithSelectorOfLinqCanGetSingleEntityWhenQueryBatchi
179178
}
180179
}
181180

181+
[Test]
182+
public async Task FutureValueWithLinqPolymorphicAggregateAsync()
183+
{
184+
using (var session = OpenSession())
185+
{
186+
var futureExists =
187+
session
188+
.Query<PolymorphicA>()
189+
.ToFutureValue(q => q.Any());
190+
Assert.That(await (futureExists.GetValueAsync()), Is.False);
191+
192+
var b = new PolymorphicB();
193+
await (session.SaveAsync(b));
194+
await (session.FlushAsync());
195+
196+
futureExists =
197+
session
198+
.Query<PolymorphicA>()
199+
.ToFutureValue(q => q.Any());
200+
Assert.That(await (futureExists.GetValueAsync()), Is.True, "Has not found B");
201+
202+
await (session.DeleteAsync(b));
203+
await (session.SaveAsync(new PolymorphicA()));
204+
await (session.FlushAsync());
205+
206+
futureExists =
207+
session
208+
.Query<PolymorphicA>()
209+
.ToFutureValue(q => q.Any());
210+
Assert.That(await (futureExists.GetValueAsync()), Is.True, "Has not found A");
211+
}
212+
}
213+
214+
[Test]
215+
public async Task NonExplicitlyExecutedFutureAreExecutedAsync()
216+
{
217+
Sfi.Statistics.IsStatisticsEnabled = true;
218+
try
219+
{
220+
using (var s = Sfi.OpenSession())
221+
{
222+
var persons = s.CreateQuery("from Person").Future<Person>();
223+
s.Query<Person>().ToFutureValue(q => q.Any());
224+
Sfi.Statistics.Clear();
225+
Assert.That((await (persons.GetEnumerableAsync())).FirstOrDefault(), Is.Null);
226+
Assert.That(Sfi.Statistics.PrepareStatementCount, Is.EqualTo(2));
227+
}
228+
}
229+
finally
230+
{
231+
Sfi.Statistics.IsStatisticsEnabled = false;
232+
}
233+
}
234+
235+
[Test]
236+
public async Task FutureIsNotReexecutedAsync()
237+
{
238+
Sfi.Statistics.IsStatisticsEnabled = true;
239+
try
240+
{
241+
using (var s = Sfi.OpenSession())
242+
{
243+
var exists = s.Query<Person>().ToFutureValue(q => q.Any());
244+
Assert.That(await (exists.GetValueAsync()), Is.False);
245+
Assert.That(Sfi.Statistics.PrepareStatementCount, Is.EqualTo(1));
246+
Sfi.Statistics.Clear();
247+
Assert.That(await (exists.GetValueAsync()), Is.False);
248+
Assert.That(Sfi.Statistics.PrepareStatementCount, Is.EqualTo(0));
249+
}
250+
}
251+
finally
252+
{
253+
Sfi.Statistics.IsStatisticsEnabled = false;
254+
}
255+
}
256+
182257
private async Task<int> CreatePersonAsync(CancellationToken cancellationToken = default(CancellationToken))
183258
{
184259
using (var session = Sfi.OpenSession())

src/NHibernate.Test/Async/Generatedkeys/Seqidentity/SequenceIdentityFixture.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ protected override string MappingsAssembly
2929

3030
protected override bool AppliesTo(Dialect.Dialect dialect)
3131
{
32-
return dialect.SupportsSequences && !(dialect is Dialect.MsSql2012Dialect);
32+
return dialect.SupportsSequences &&
33+
!(dialect is Dialect.MsSql2012Dialect) &&
34+
!(dialect is Dialect.HanaDialectBase); // SAP HANA does not support a syntax allowing to return the inserted id as an output parameter or a return value
3335
}
3436

3537
[Test]
@@ -49,4 +51,4 @@ public async Task SequenceIdentityGeneratorAsync()
4951
session.Close();
5052
}
5153
}
52-
}
54+
}

src/NHibernate.Test/Async/GenericTest/Overall/Fixture.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ public async Task CRUDAsync()
5353
[Test]
5454
public async Task CRUDABAsync()
5555
{
56+
if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator)
57+
Assert.Ignore("Support of empty inserts is required");
58+
5659
var entity = new A<B>
5760
{
5861
Property = new B { Prop = 2 },

src/NHibernate.Test/Async/Hql/HQLFunctions.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -947,6 +947,13 @@ public async Task CastAsync()
947947
throw;
948948
}
949949
}
950+
else if (Dialect is HanaDialectBase)
951+
{
952+
string msgToCheck =
953+
"not a GROUP BY expression: 'ANIMAL0_.BODYWEIGHT' must be in group by clause";
954+
if (!ex.InnerException.Message.Contains(msgToCheck))
955+
throw;
956+
}
950957
else
951958
{
952959
string msgToCheck =
@@ -1144,7 +1151,7 @@ public async Task StrAsync()
11441151
[Test]
11451152
public async Task IifAsync()
11461153
{
1147-
AssumeFunctionSupported("Iif");
1154+
AssumeFunctionSupported("iif");
11481155
using (ISession s = OpenSession())
11491156
{
11501157
await (s.SaveAsync(new MaterialResource("Flash card 512MB", "A001/07", MaterialResource.MaterialState.Available)));

src/NHibernate.Test/Async/Insertordering/FamilyModel/Fixture.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ protected override string MappingsAssembly
2929
get { return "NHibernate.Test"; }
3030
}
3131

32+
protected override bool AppliesTo(Dialect.Dialect dialect)
33+
{
34+
return TestDialect.SupportsBatchingDependentDML;
35+
}
36+
3237
protected override void Configure(Configuration configuration)
3338
{
3439
configuration.DataBaseIntegration(x =>
@@ -105,4 +110,4 @@ public async System.Threading.Tasks.Task CircularReferencesAsync()
105110
}
106111
}
107112
}
108-
}
113+
}

src/NHibernate.Test/Async/Legacy/FooBarTest.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2490,7 +2490,7 @@ public async Task CollectionsInSelectAsync()
24902490
// probably the conversion ProxyArray.id (to_number ensuring a not null value)
24912491
// Indeed, ProxyArray.id is Glarch.tha_key which is a string filled with a Guid. It does
24922492
// not fail with most engine likely because there are no results thanks to other conditions.
2493-
if (!(Dialect is Oracle8iDialect) && !(Dialect is MsSqlCeDialect))
2493+
if (!(Dialect is Oracle8iDialect) && !(Dialect is MsSqlCeDialect) && !(Dialect is HanaDialectBase))
24942494
{
24952495
await (s.CreateQuery(
24962496
"select count(*) from Bar as bar join bar.Component.Glarch.ProxyArray as g where cast(g.id as Int32) in indices(bar.Baz.FooArray)").
@@ -4103,6 +4103,9 @@ public async Task UpdateOrderAsync()
41034103
[Test]
41044104
public async Task UpdateFromTransientAsync()
41054105
{
4106+
if (!TestDialect.SupportsBatchingDependentDML)
4107+
Assert.Ignore($"Dialect {Dialect} does not support batching of dependent DML (fee update on related fee)");
4108+
41064109
ISession s = OpenSession();
41074110
Fee fee1 = new Fee();
41084111
await (s.SaveAsync(fee1));

src/NHibernate.Test/Async/Legacy/FumTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,4 +727,4 @@ private ISession SpoofSerialization(ISession session)
727727
return (ISession) formatter.Deserialize(stream);
728728
}
729729
}
730-
}
730+
}

src/NHibernate.Test/Async/Legacy/MasterDetailTest.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ protected override IList Mappings
5252
[Test]
5353
public async Task ParentChildrenAsync()
5454
{
55+
if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator)
56+
Assert.Ignore("Support of empty inserts is required");
57+
5558
ISession session = OpenSession();
5659

5760
M parent = new M();
@@ -842,6 +845,9 @@ public async Task MixNativeAssignedAsync()
842845
[Test]
843846
public async Task CollectionReplaceOnUpdateAsync()
844847
{
848+
if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator)
849+
Assert.Ignore("Support of empty inserts is required");
850+
845851
ISession s = OpenSession();
846852
ITransaction t = s.BeginTransaction();
847853
Category c = new Category();
@@ -887,6 +893,9 @@ public async Task CollectionReplaceOnUpdateAsync()
887893
[Test]
888894
public async Task CollectionReplace2Async()
889895
{
896+
if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator)
897+
Assert.Ignore("Support of empty inserts is required");
898+
890899
ISession s = OpenSession();
891900
ITransaction t = s.BeginTransaction();
892901
Category c = new Category();
@@ -926,6 +935,9 @@ public async Task CollectionReplace2Async()
926935
[Test]
927936
public async Task CollectionReplaceAsync()
928937
{
938+
if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator)
939+
Assert.Ignore("Support of empty inserts is required");
940+
929941
ISession s = OpenSession();
930942
ITransaction t = s.BeginTransaction();
931943
Category c = new Category();
@@ -971,6 +983,9 @@ public async Task CollectionReplaceAsync()
971983
[Test]
972984
public async Task CategoriesAsync()
973985
{
986+
if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator)
987+
Assert.Ignore("Support of empty inserts is required");
988+
974989
Category c = new Category();
975990
c.Name = Category.RootCategory;
976991
Category c1 = new Category();
@@ -1012,6 +1027,9 @@ public async Task CategoriesAsync()
10121027
[Test]
10131028
public async Task CollectionRefreshAsync()
10141029
{
1030+
if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator)
1031+
Assert.Ignore("Support of empty inserts is required");
1032+
10151033
ISession s = OpenSession();
10161034
Category c = new Category();
10171035
IList<Category> list = new List<Category>();
@@ -1055,6 +1073,9 @@ public async Task CollectionRefreshAsync()
10551073
[Test]
10561074
public async Task CachedCollectionRefreshAsync()
10571075
{
1076+
if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator)
1077+
Assert.Ignore("Support of empty inserts is required");
1078+
10581079
ISession s = OpenSession();
10591080
Category c = new Category();
10601081
IList<Category> list = new List<Category>();
@@ -1240,6 +1261,9 @@ public async Task QueuedBagAddsAsync()
12401261
[Test]
12411262
public async Task PolymorphicCriteriaAsync()
12421263
{
1264+
if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator)
1265+
Assert.Ignore("Support of empty inserts is required");
1266+
12431267
ISession s = OpenSession();
12441268
ITransaction txn = s.BeginTransaction();
12451269
Category f = new Category();

0 commit comments

Comments
 (0)