Skip to content

Commit 0c0a05f

Browse files
committed
Merge branches 'amroel-NH-3660', 'amroel-NH-3687', 'amroel-NH-3688', 'amroel-NH-3689', 'amroel-NH-3690', 'amroel-NH-3691', 'amroel-NH-3692', 'amroel-NH-3695' and 'amroel-NH-3696'
9 parents 14a13b6 + bc36225 + 650aaf0 + 4d07975 + 9bbaa0f + da94a4e + 8b2570d + 6c596b2 + 075d642 commit 0c0a05f

File tree

25 files changed

+700
-248
lines changed

25 files changed

+700
-248
lines changed

lib/teamcity/firebird/NHibernate.Test.last-results.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14895,10 +14895,10 @@ TearDown : Test didn't clean up after itself. session closed: True database clea
1489514895
<test-case name="NHibernate.Test.TypesTest.CharClassFixture.ReadWrite" executed="True" result="Success" success="True" asserts="0" />
1489614896
</results>
1489714897
</test-suite>
14898-
<test-suite type="TestFixture" name="CurrencyTypeFixture" executed="True" result="Failure" success="False" asserts="0">
14898+
<test-suite type="TestFixture" name="CurrencyTypeFixture" executed="True" result="Success" success="True" asserts="0">
1489914899
<results>
1490014900
<test-case name="NHibernate.Test.TypesTest.CurrencyTypeFixture.Equals" executed="True" result="Success" success="True" asserts="1" />
14901-
<test-case name="NHibernate.Test.TypesTest.CurrencyTypeFixture.ReadWrite" executed="True" result="Failure" success="False" asserts="0">
14901+
<test-case name="NHibernate.Test.TypesTest.CurrencyTypeFixture.ReadWrite" executed="True" result="Success" success="True" asserts="0">
1490214902
<failure>
1490314903
<message><![CDATA[System.ArgumentException : Invalid data type
1490414904
TearDown : Test didn't clean up after itself. session closed: False database cleaned: True connection closed: True]]></message>

src/NHibernate.DomainModel/Northwind/Mappings/TimeSheet.hbm.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
<class name="TimesheetEntry" table="TimesheetEntries">
2323
<id name="Id" column="TimesheetEntryId">
24-
<generator class="native" />
24+
<generator class="assigned" />
2525
</id>
2626

2727
<property name="EntryDate" />

src/NHibernate.Test/Linq/NorthwindDbCreator.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,14 @@ public static void CreateMiscTestData(ISession session)
8787
{
8888
new TimesheetEntry
8989
{
90+
Id = 1,
9091
EntryDate = KnownDate,
9192
NumberOfHours = 6,
9293
Comments = "testing 123"
9394
},
9495
new TimesheetEntry
9596
{
97+
Id = 2,
9698
EntryDate = KnownDate.AddDays(1),
9799
NumberOfHours = 14
98100
}
@@ -107,22 +109,26 @@ public static void CreateMiscTestData(ISession session)
107109
{
108110
new TimesheetEntry
109111
{
112+
Id = 3,
110113
EntryDate = DateTime.Now.AddMinutes(20),
111114
NumberOfHours = 4
112115
},
113116
new TimesheetEntry
114117
{
118+
Id = 4,
115119
EntryDate = DateTime.Now.AddMinutes(10),
116120
NumberOfHours = 8,
117121
Comments = "testing 456"
118122
},
119123
new TimesheetEntry
120124
{
125+
Id = 5,
121126
EntryDate = DateTime.Now.AddMinutes(13),
122127
NumberOfHours = 7
123128
},
124129
new TimesheetEntry
125130
{
131+
Id = 6,
126132
EntryDate = DateTime.Now.AddMinutes(45),
127133
NumberOfHours = 38
128134
}

src/NHibernate.Test/NHSpecificTest/NH1171/Fixture.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
using NHibernate.Cfg;
2+
using NHibernate.Dialect;
23
using NUnit.Framework;
34

45
namespace NHibernate.Test.NHSpecificTest.NH1171
56
{
67
[TestFixture]
7-
public class Fixture: BugTestCase
8+
public class Fixture : BugTestCase
89
{
10+
protected override bool AppliesTo(Dialect.Dialect dialect)
11+
{
12+
// Firebird has issues with comments containing apostrophes
13+
return !(dialect is FirebirdDialect);
14+
}
15+
916
protected override void Configure(NHibernate.Cfg.Configuration configuration)
1017
{
1118
configuration.SetProperty(Environment.FormatSql, "false");
@@ -25,7 +32,7 @@ ORDER BY Name
2532
";
2633
using (ISession s = OpenSession())
2734
{
28-
var q =s.CreateSQLQuery(sql);
35+
var q = s.CreateSQLQuery(sql);
2936
q.SetString("name", "Evgeny Potashnik");
3037
q.List();
3138
}

src/NHibernate.Test/NHSpecificTest/NH1391/Fixture.cs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ namespace NHibernate.Test.NHSpecificTest.NH1391
44
[TestFixture]
55
public class Fixture:BugTestCase
66
{
7+
private object _idOfPersonWithAnimals;
8+
private object _idOfPersonWithCats;
9+
private object _idOfPersonWithDogs;
10+
private object _idOfPersonWithSivasKangals;
11+
712
protected override void OnSetUp()
813
{
914
using(var session=OpenSession())
@@ -51,10 +56,10 @@ protected override void OnSetUp()
5156
session.Save(dogForSivasKangals);
5257
session.Save(catForSivasKangals);
5358

54-
session.Save(personWithAnimals);
55-
session.Save(personWithCats);
56-
session.Save(personWithDogs);
57-
session.Save(personWithSivasKangals);
59+
_idOfPersonWithAnimals = session.Save(personWithAnimals);
60+
_idOfPersonWithCats = session.Save(personWithCats);
61+
_idOfPersonWithDogs = session.Save(personWithDogs);
62+
_idOfPersonWithSivasKangals = session.Save(personWithSivasKangals);
5863

5964

6065

@@ -79,10 +84,10 @@ public void Can_discriminate_subclass_on_list_with_lazy_loading_when_used_get()
7984
using (var session = OpenSession())
8085
using (var tran = session.BeginTransaction())
8186
{
82-
var personWithAnimals = session.Get<PersonWithAnimals>(1);
83-
var personWithCats = session.Get<PersonWithCats>(2);
84-
var personWithDogs = session.Get<PersonWithDogs>(3);
85-
var personWithSivasKangals = session.Get<PersonWithSivasKangals>(4);
87+
var personWithAnimals = session.Get<PersonWithAnimals>(_idOfPersonWithAnimals);
88+
var personWithCats = session.Get<PersonWithCats>(_idOfPersonWithCats);
89+
var personWithDogs = session.Get<PersonWithDogs>(_idOfPersonWithDogs);
90+
var personWithSivasKangals = session.Get<PersonWithSivasKangals>(_idOfPersonWithSivasKangals);
8691

8792
Assert.That(personWithAnimals.AnimalsGeneric,Has.Count.EqualTo(4));
8893

src/NHibernate.Test/NHSpecificTest/NH1487/Fixture.cs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
using System;
12
using System.Text;
23
using NHibernate.Cfg;
34
using NHibernate.Dialect;
45
using NHibernate.Tool.hbm2ddl;
56
using NUnit.Framework;
6-
using System;
77

88
namespace NHibernate.Test.NHSpecificTest.NH1487
99
{
@@ -34,7 +34,8 @@ public Configuration GetConf()
3434
[Test]
3535
public void GenerateSchemaMultipleUniqueKeys()
3636
{
37-
if(!(Dialect.Dialect.GetDialect() is MsSql2000Dialect))
37+
var cfg = GetConf();
38+
if(!(Dialect.Dialect.GetDialect(cfg.Properties) is MsSql2000Dialect))
3839
{
3940
Assert.Ignore("Specific for MsSql2000Dialect");
4041
}
@@ -52,8 +53,6 @@ public void GenerateSchemaMultipleUniqueKeys()
5253
</class>
5354
</hibernate-mapping>";
5455

55-
var cfg = GetConf();
56-
5756
cfg.AddXmlString(hbm);
5857

5958
// Can create the schema
@@ -70,7 +69,8 @@ public void GenerateSchemaMultipleUniqueKeys()
7069
[Test]
7170
public void GenerateSchemaMultipleIndex()
7271
{
73-
if (!(Dialect.Dialect.GetDialect() is MsSql2000Dialect))
72+
var cfg = GetConf();
73+
if (!(Dialect.Dialect.GetDialect(cfg.Properties) is MsSql2000Dialect))
7474
{
7575
Assert.Ignore("Specific for MsSql2000Dialect");
7676
}
@@ -88,7 +88,6 @@ public void GenerateSchemaMultipleIndex()
8888
</class>
8989
</hibernate-mapping>";
9090

91-
var cfg = GetConf();
9291
cfg.AddXmlString(hbm);
9392

9493
var scriptB = new StringBuilder();
@@ -103,7 +102,8 @@ public void GenerateSchemaMultipleIndex()
103102
[Test]
104103
public void GenerateSchemaMultipleIndexOnColumn()
105104
{
106-
if (!(Dialect.Dialect.GetDialect() is MsSql2000Dialect))
105+
var cfg = GetConf();
106+
if (!(Dialect.Dialect.GetDialect(cfg.Properties) is MsSql2000Dialect))
107107
{
108108
Assert.Ignore("Specific for MsSql2000Dialect");
109109
}
@@ -127,7 +127,6 @@ public void GenerateSchemaMultipleIndexOnColumn()
127127
</class>
128128
</hibernate-mapping>";
129129

130-
var cfg = GetConf();
131130
cfg.AddXmlString(hbm);
132131

133132
var scriptB = new StringBuilder();
@@ -141,7 +140,8 @@ public void GenerateSchemaMultipleIndexOnColumn()
141140
[Test]
142141
public void GenerateSchemaIndexOnId()
143142
{
144-
if (!(Dialect.Dialect.GetDialect() is MsSql2000Dialect))
143+
var cfg = GetConf();
144+
if (!(Dialect.Dialect.GetDialect(cfg.Properties) is MsSql2000Dialect))
145145
{
146146
Assert.Ignore("Specific for MsSql2000Dialect");
147147
}
@@ -160,7 +160,6 @@ public void GenerateSchemaIndexOnId()
160160
</class>
161161
</hibernate-mapping>";
162162

163-
var cfg = GetConf();
164163
cfg.AddXmlString(hbm);
165164

166165
var scriptB = new StringBuilder();
@@ -175,7 +174,8 @@ public void GenerateSchemaIndexOnId()
175174
[Test]
176175
public void GenerateSchemaUniqueOnId()
177176
{
178-
if (!(Dialect.Dialect.GetDialect() is MsSql2000Dialect))
177+
var cfg = GetConf();
178+
if (!(Dialect.Dialect.GetDialect(cfg.Properties) is MsSql2000Dialect))
179179
{
180180
Assert.Ignore("Specific for MsSql2000Dialect");
181181
}
@@ -194,7 +194,6 @@ public void GenerateSchemaUniqueOnId()
194194
</class>
195195
</hibernate-mapping>";
196196

197-
var cfg = GetConf();
198197
cfg.AddXmlString(hbm);
199198

200199
var scriptB = new StringBuilder();

src/NHibernate.Test/NHSpecificTest/NH1845/Fixture.cs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,24 @@
33
using NUnit.Framework;
44
namespace NHibernate.Test.NHSpecificTest.NH1845
55
{
6-
public class Fixture: TestCaseMappingByCode
6+
public class Fixture : TestCaseMappingByCode
77
{
88

99
protected override HbmMapping GetMappings()
1010
{
1111
var mapper = new ModelMapper();
1212
mapper.Class<Category>(rc =>
13-
{
14-
rc.Id(x=> x.Id, map=> map.Generator(Generators.Native));
15-
rc.Property(x=> x.Name);
16-
rc.ManyToOne(x=> x.Parent, map=> map.Column("ParentId"));
17-
rc.Bag(x => x.Subcategories, map =>
18-
{
19-
map.Access(Accessor.NoSetter);
20-
map.Key(km=> km.Column("ParentId"));
21-
map.Cascade(Mapping.ByCode.Cascade.All.Include(Mapping.ByCode.Cascade.DeleteOrphans));
22-
}, rel => rel.OneToMany());
23-
});
13+
{
14+
rc.Id(x => x.Id, map => map.Generator(Generators.Native));
15+
rc.Property(x => x.Name);
16+
rc.ManyToOne(x => x.Parent, map => map.Column("ParentId"));
17+
rc.Bag(x => x.Subcategories, map =>
18+
{
19+
map.Access(Accessor.NoSetter);
20+
map.Key(km => km.Column("ParentId"));
21+
map.Cascade(Mapping.ByCode.Cascade.All.Include(Mapping.ByCode.Cascade.DeleteOrphans));
22+
}, rel => rel.OneToMany());
23+
});
2424
var mappings = mapper.CompileMappingForAllExplicitlyAddedEntities();
2525
return mappings;
2626
}
@@ -44,6 +44,9 @@ public void LazyLoad_Initialize_AndEvict()
4444
using (ISession session = OpenSession())
4545
using (ITransaction transaction = session.BeginTransaction())
4646
{
47+
// first delete children
48+
session.CreateQuery("delete from Category where Parent != null").ExecuteUpdate();
49+
// then the rest
4750
session.CreateQuery("delete from Category").ExecuteUpdate();
4851
transaction.Commit();
4952
}

src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/Fixture.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Threading;
5+
using NHibernate.Util;
56
using NUnit.Framework;
67

78
namespace NHibernate.Test.NHSpecificTest.NH1908ThreadSafety
@@ -17,6 +18,23 @@ protected override bool AppliesTo(Dialect.Dialect dialect)
1718
// http://www.orafaq.com/forum/t/60019/2/ & http://www.ispirer.com/wiki/sqlways/troubleshooting-guide/oracle/import/tns_listener
1819
}
1920

21+
protected override void OnTearDown()
22+
{
23+
base.OnTearDown();
24+
25+
if (!(Dialect is Dialect.FirebirdDialect))
26+
return;
27+
28+
// Firebird will pool each connection created during the test and will not drop the created tables
29+
// which will result in other tests failing when they try to create tables with same name
30+
// By clearing the connection pool the tables will get dropped. This is done by the following code.
31+
var fbConnectionType = ReflectHelper.TypeFromAssembly("FirebirdSql.Data.FirebirdClient.FbConnection", "FirebirdSql.Data.FirebirdClient", false);
32+
var clearPool = fbConnectionType.GetMethod("ClearPool");
33+
var sillyConnection = sessions.ConnectionProvider.GetConnection();
34+
clearPool.Invoke(null, new object[] { sillyConnection });
35+
sessions.ConnectionProvider.CloseConnection(sillyConnection);
36+
}
37+
2038
[Test]
2139
public void UsingFiltersIsThreadSafe()
2240
{

0 commit comments

Comments
 (0)