Skip to content

Commit befc434

Browse files
committed
Merge branch '7.1' into 7.2
# Conflicts: # Orm/Xtensive.Orm.Tests.Framework/Orm.config
2 parents 19baf81 + 1cb1064 commit befc434

11 files changed

Lines changed: 260 additions & 188 deletions

File tree

Orm/Xtensive.Orm.Tests.Framework/Orm.config

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@
3636
<domain name="mssql2022"
3737
connectionUrl="sqlserver://dotest:dotest@localhost\DO_SQL2022:1422/DO-Tests?MultipleActiveResultSets=True" />
3838

39+
<!-- A hook to have abitity to check and test newer, yet not supported, versions without adding them to the file -->
40+
<!-- This allows to override it in storage configuration files -->
41+
<domain name="mssqlnext"
42+
connectionUrl="sqlserver://localhost/DO-Tests?MultipleActiveResultSets=True" />
43+
3944
<domain name="pgsql83"
4045
connectionUrl="postgresql://dotest:dotest@localhost:5483/dotest" />
4146

@@ -81,12 +86,22 @@
8186
<domain name="pgsql180"
8287
connectionUrl="postgresql://dotest:dotest@localhost:54180/dotest" />
8388

89+
<!-- A hook to have abitity to check and test newer, yet not supported, versions without adding them to the file -->
90+
<!-- This allows to override it in storage configuration files -->
91+
<domain name="pgsqlnext"
92+
connectionUrl="postgresql://dotest:dotest@localhost:54170/dotest" />
93+
8494
<domain name="oracle10"
8595
connectionUrl="oracle://dotest:dotest@localhost:5510/ora10" />
8696

8797
<domain name="oracle11"
8898
connectionUrl="oracle://dotest:dotest@localhost:5511/ora11" />
8999

100+
<!-- A hook to have abitity to check and test newer, yet not supported, versions without adding them to the file -->
101+
<!-- This allows to override it in storage configuration files -->
102+
<domain name="oraclenext"
103+
connectionUrl="oracle://dotest:dotest@localhost:5511/ora11" />
104+
90105
<domain name="mysql55"
91106
connectionUrl="mysql://dotest:dotest@localhost:3355/dotest" />
92107

@@ -123,6 +138,11 @@
123138
<domain name="mysql93"
124139
connectionUrl="mysql://dotest:dotest@localhost:3393/dotest" />
125140

141+
<!-- A hook to have abitity to check and test newer, yet not supported, versions without adding them to the file -->
142+
<!-- This allows to override it in storage configuration files -->
143+
<domain name="mysqlnext"
144+
connectionUrl="mysql://dotest:dotest@localhost:3390/dotest" />
145+
126146
<domain name="firebird25"
127147
connectionUrl="firebird://dotest:dotest@localhost:3050/dotest" />
128148

@@ -135,6 +155,11 @@
135155
<domain name="firebird50"
136156
connectionUrl="firebird://dotest:dotest@localhost:3055/dotest" />
137157

158+
<!-- A hook to have abitity to check and test newer, yet not supported, versions without adding them to the file -->
159+
<!-- This allows to override it in storage configuration files -->
160+
<domain name="firebirdnext"
161+
connectionUrl="firebird://dotest:dotest@localhost:3055/dotest" />
162+
138163
<domain name="sqlite3"
139164
connectionUrl="sqlite:///DO-Tests.db3" />
140165

@@ -170,6 +195,11 @@
170195
<domain name="mssql2022cs" provider="sqlserver"
171196
connectionString="Data Source=localhost\DO_SQL2022,1422;Initial Catalog=DO-Tests;User ID=dotest;Password=dotest;MultipleActiveResultSets=True;Encrypt=false" />
172197

198+
<!-- A hook to have abitity to check and test newer, yet not supported, versions without adding them to the file -->
199+
<!-- This allows to override it in storage configuration files -->
200+
<domain name="mssqlnextcs" provider="sqlserver"
201+
connectionString="Data Source=localhost;Initial Catalog=DO-Tests;Integrated Security=True;MultipleActiveResultSets=True" />
202+
173203
<domain name="pgsql83cs" provider="postgresql"
174204
connectionString="HOST=localhost;PORT=5483;DATABASE=dotest;USER ID=dotest;PASSWORD=dotest" />
175205

@@ -215,12 +245,22 @@
215245
<domain name="pgsql180cs" provider="postgresql"
216246
connectionString="HOST=localhost;PORT=54180;DATABASE=dotest;USER ID=dotest;PASSWORD=dotest" />
217247

248+
<!-- A hook to have abitity to check and test newer, yet not supported, versions without adding them to the file -->
249+
<!-- This allows to override it in storage configuration files -->
250+
<domain name="pgsqlnextcs" provider="postgresql"
251+
connectionString="HOST=localhost;PORT=54170;DATABASE=dotest;USER ID=dotest;PASSWORD=dotest" />
252+
218253
<domain name="oracle10cs" provider="oracle"
219254
connectionString="DATA SOURCE=&quot;(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=5510))(CONNECT_DATA=(SERVICE_NAME=ora10)))&quot;;USER ID=dotest;PASSWORD=dotest" />
220255

221256
<domain name="oracle11cs" provider="oracle"
222257
connectionString="DATA SOURCE=&quot;(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=5511))(CONNECT_DATA=(SERVICE_NAME=ora11)))&quot;;USER ID=dotest;PASSWORD=dotest" />
223258

259+
<!-- A hook to have abitity to check and test newer, yet not supported, versions without adding them to the file -->
260+
<!-- This allows to override it in storage configuration files -->
261+
<domain name="oraclenextcs" provider="oracle"
262+
connectionString="DATA SOURCE=&quot;(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=5511))(CONNECT_DATA=(SERVICE_NAME=ora11)))&quot;;USER ID=dotest;PASSWORD=dotest" />
263+
224264
<domain name="mysql55cs" provider="mysql"
225265
connectionString="Server=localhost;Port=3355;Database=dotest;Uid=dotest;Pwd=dotest" />
226266

@@ -257,6 +297,11 @@
257297
<domain name="mysql93cs" provider="mysql"
258298
connectionString="Server=localhost;Port=3393;Database=dotest;Uid=dotest;Pwd=dotest" />
259299

300+
<!-- A hook to have abitity to check and test newer, yet not supported, versions without adding them to the file -->
301+
<!-- This allows to override it in storage configuration files -->
302+
<domain name="mysqlnextcs" provider="mysql"
303+
connectionString="Server=localhost;Port=3393;Database=dotest;Uid=dotest;Pwd=dotest" />
304+
260305
<domain name="firebird25cs" provider="firebird"
261306
connectionString="User=dotest;Password=dotest;Database=dotest;DataSource=localhost;Port=3050;Dialect=3;Charset=UTF8;Role=;Connection lifetime=15;Pooling=true;MinPoolSize=0;MaxPoolSize=50;Packet Size=8192;ServerType=0" />
262307

@@ -269,6 +314,11 @@
269314
<domain name="firebird50cs" provider="firebird"
270315
connectionString="User=dotest;Password=dotest;Database=dotest;DataSource=localhost;Port=3055;Dialect=3;Charset=UTF8;Role=;Connection lifetime=15;Pooling=true;MinPoolSize=0;MaxPoolSize=50;Packet Size=8192;ServerType=0" />
271316

317+
<!-- A hook to have abitity to check and test newer, yet not supported, versions without adding them to the file -->
318+
<!-- This allows to override it in storage configuration files -->
319+
<domain name="firebirdnextcs" provider="firebird"
320+
connectionString="User=dotest;Password=dotest;Database=dotest;DataSource=localhost;Port=3055;Dialect=3;Charset=UTF8;Role=;Connection lifetime=15;Pooling=true;MinPoolSize=0;MaxPoolSize=50;Packet Size=8192;ServerType=0" />
321+
272322
<domain name="sqlite3cs" provider="sqlite"
273323
connectionString="Data Source=DO-Tests.db3" />
274324
</domains>

Orm/Xtensive.Orm.Tests/Interfaces/KeyStructureConflictTest.cs

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -45,25 +45,17 @@ public class Child2 : Root2, IChild
4545

4646
namespace Xtensive.Orm.Tests.Interfaces
4747
{
48-
public class KeyStructureConflictTest : AutoBuildTest
48+
public class KeyStructureConflictTest
4949
{
50-
protected override DomainConfiguration BuildConfiguration()
50+
[Test]
51+
public void MainTest()
5152
{
52-
var config = base.BuildConfiguration();
53+
var config = DomainConfigurationFactory.Create();
5354
config.Types.RegisterCaching(typeof (Root1).Assembly, typeof (Root1).Namespace);
54-
return config;
55-
}
56-
57-
protected override Domain BuildDomain(DomainConfiguration configuration)
58-
{
59-
try {
60-
base.BuildDomain(configuration);
61-
Assert.Fail();
62-
}
63-
catch (DomainBuilderException e) {
64-
Console.WriteLine(e);
65-
}
66-
return null;
55+
var ex = Assert.Throws<DomainBuilderException>(() => Domain.Build(config));
56+
var message = ex.Message;
57+
Assert.That(message.Contains("IChild") && message.Contains("different key structure") && message.Contains("Root1 & Root2"),
58+
Is.True);
6759
}
6860
}
6961
}

Orm/Xtensive.Orm.Tests/Interfaces/TypeIdModeConflictTest.cs

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,17 @@ public class Root2 : Entity, IRoot
3434

3535
namespace Xtensive.Orm.Tests.Interfaces
3636
{
37-
public class TypeIdModeConflictTest : AutoBuildTest
37+
public class TypeIdModeConflictTest
3838
{
39-
protected override DomainConfiguration BuildConfiguration()
39+
[Test]
40+
public void MainTest()
4041
{
41-
var config = base.BuildConfiguration();
42+
var config = DomainConfigurationFactory.Create();
4243
config.Types.RegisterCaching(typeof (Root1).Assembly, typeof (Root1).Namespace);
43-
return config;
44-
}
45-
46-
protected override Domain BuildDomain(DomainConfiguration configuration)
47-
{
48-
try {
49-
base.BuildDomain(configuration);
50-
Assert.Fail();
51-
}
52-
catch (DomainBuilderException e) {
53-
Console.WriteLine(e);
54-
}
55-
return null;
44+
var ex = Assert.Throws<DomainBuilderException>(() => Domain.Build(config));
45+
var message = ex.Message;
46+
Assert.That(message.Contains("IRoot") && message.Contains("one of which includes TypeId, but another doesn't") && message.Contains("Root1 & Root2"),
47+
Is.True);
5648
}
5749
}
5850
}

Orm/Xtensive.Orm.Tests/Interfaces/UnusedTypeRemovalTest.cs

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -51,31 +51,18 @@ public class First : Entity, IFirst
5151

5252
namespace Xtensive.Orm.Tests.Interfaces
5353
{
54-
public class UnusedTypeRemovalTest : AutoBuildTest
54+
public class UnusedTypeRemovalTest
5555
{
5656
[Test]
5757
public void MainTest()
5858
{
59-
Assert.IsNull(Domain);
60-
}
59+
var config = DomainConfigurationFactory.Create();
60+
config.Types.RegisterCaching(typeof(IFirst).Assembly, typeof(IFirst).Namespace);
6161

62-
protected override DomainConfiguration BuildConfiguration()
63-
{
64-
var config = base.BuildConfiguration();
65-
config.Types.RegisterCaching(typeof (IFirst).Assembly, typeof (IFirst).Namespace);
66-
return config;
67-
}
68-
69-
protected override Domain BuildDomain(DomainConfiguration configuration)
70-
{
71-
try {
72-
base.BuildDomain(configuration);
73-
Assert.Fail();
74-
}
75-
catch (DomainBuilderException e) {
76-
Console.WriteLine(e);
77-
}
78-
return null;
62+
var ex = Assert.Throws<DomainBuilderException>(() => Domain.Build(config));
63+
var message = ex.Message;
64+
Assert.That(message.Contains("ISecond") && message.Contains("don't belong") && message.Contains("hierarchy"),
65+
Is.True);
7966
}
8067
}
8168
}

Orm/Xtensive.Orm.Tests/Issues/Issue0262_StructureAssignment.cs

Lines changed: 22 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -64,53 +64,40 @@ protected override DomainConfiguration BuildConfiguration()
6464
[Test]
6565
public void SetTest()
6666
{
67-
using (var session = Domain.OpenSession()) {
68-
using (var t = session.OpenTransaction()) {
69-
70-
var container = new Container();
71-
try {
72-
container.Value = new Triple();
73-
Assert.Fail();
74-
} catch (InvalidOperationException) {
75-
76-
}
77-
78-
// Rollback
79-
}
67+
using (var session = Domain.OpenSession())
68+
using (var t = session.OpenTransaction()) {
69+
70+
var container = new Container();
71+
_ = Assert.Throws<InvalidOperationException>(() => { container.Value = new Triple(); });
72+
73+
// Rollback
8074
}
8175
}
8276

8377
[Test]
8478
public void CastTest()
8579
{
86-
using (var session = Domain.OpenSession()) {
87-
using (var t = session.OpenTransaction()) {
88-
89-
var container = new Container();
90-
try {
91-
container.Value = (Pair)new Triple();
92-
Assert.Fail();
93-
} catch (InvalidOperationException) {
94-
95-
}
96-
97-
// Rollback
98-
}
80+
using (var session = Domain.OpenSession())
81+
using (var t = session.OpenTransaction()) {
82+
83+
var container = new Container();
84+
_ = Assert.Throws<InvalidOperationException>(() => { container.Value = (Pair) new Triple(); });
85+
86+
// Rollback
9987
}
10088
}
10189

10290
[Test]
10391
public void ValidTest()
10492
{
105-
using (var session = Domain.OpenSession()) {
106-
using (var t = session.OpenTransaction()) {
107-
108-
var container = new Container();
109-
var triple = new Triple();
110-
container.Value = new Pair(triple.One, triple.Two);
111-
112-
// Rollback
113-
}
93+
using (var session = Domain.OpenSession())
94+
using (var t = session.OpenTransaction()) {
95+
96+
var container = new Container();
97+
var triple = new Triple();
98+
container.Value = new Pair(triple.One, triple.Two);
99+
100+
// Rollback
114101
}
115102
}
116103
}

Orm/Xtensive.Orm.Tests/Issues/IssueJira0197_ExtendedErrorInformation.cs

Lines changed: 25 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -43,68 +43,51 @@ protected override void CheckRequirements()
4343
protected override DomainConfiguration BuildConfiguration()
4444
{
4545
var config = base.BuildConfiguration();
46-
config.Types.RegisterCaching(typeof (ErrorProvider).Assembly, typeof (ErrorProvider).Namespace);
46+
config.Types.Register(typeof(ErrorProvider));
4747
return config;
4848
}
4949

5050
[Test]
5151
public void InsertNullTest()
5252
{
53-
using (var session = Domain.OpenSession()) {
54-
using (var t = session.OpenTransaction()) {
55-
try {
56-
new ErrorProvider(1);
57-
session.SaveChanges();
58-
}
59-
catch (CheckConstraintViolationException exception) {
60-
var expected = Domain.Model.Types[typeof (ErrorProvider)];
61-
Assert.AreEqual(expected, exception.Info.Type);
62-
Assert.AreEqual(expected.Fields["NotNull"], exception.Info.Field);
63-
}
64-
}
53+
using (var session = Domain.OpenSession())
54+
using (var t = session.OpenTransaction()) {
55+
_ = new ErrorProvider(1);
56+
var ex = Assert.Throws<CheckConstraintViolationException>(() => session.SaveChanges());
57+
var expected = Domain.Model.Types[typeof(ErrorProvider)];
58+
Assert.That(ex.Info.Type, Is.EqualTo(expected));
59+
Assert.That(ex.Info.Field, Is.EqualTo(expected.Fields[nameof(ErrorProvider.NotNull)]));
6560
}
6661
}
6762

6863
[Test]
6964
public void DuplicateUniqueIndexTest()
7065
{
71-
using (var session = Domain.OpenSession()) {
72-
using (var t = session.OpenTransaction()) {
73-
try {
74-
new ErrorProvider(2) {NotNull = string.Empty, Unique = 2};
75-
session.SaveChanges();
76-
new ErrorProvider(3) {NotNull = string.Empty, Unique = 2};
77-
session.SaveChanges();
78-
Assert.Fail();
79-
}
80-
catch (UniqueConstraintViolationException exception) {
81-
Assert.AreEqual(Domain.Model.Types[typeof (ErrorProvider)], exception.Info.Type);
82-
}
83-
}
66+
using (var session = Domain.OpenSession())
67+
using (var t = session.OpenTransaction()) {
68+
_ = new ErrorProvider(2) { NotNull = string.Empty, Unique = 2 };
69+
session.SaveChanges();
70+
_ = new ErrorProvider(3) { NotNull = string.Empty, Unique = 2 };
71+
var ex = Assert.Throws<UniqueConstraintViolationException>(() => session.SaveChanges());
72+
Assert.That(ex.Info.Type, Is.EqualTo(Domain.Model.Types[typeof(ErrorProvider)]));
8473
}
8574
}
8675

8776
[Test]
8877
public void DuplicatePrimaryKeyTest()
8978
{
90-
using (var session = Domain.OpenSession()) {
91-
using (var t = session.OpenTransaction()) {
92-
new ErrorProvider(3) {NotNull = string.Empty, Unique = 31};
93-
t.Complete();
94-
}
79+
using (var session = Domain.OpenSession())
80+
using (var t = session.OpenTransaction()) {
81+
_ = new ErrorProvider(3) { NotNull = string.Empty, Unique = 31 };
82+
t.Complete();
9583
}
9684

97-
using (var session = Domain.OpenSession()) {
98-
using (var t = session.OpenTransaction()) {
99-
try {
100-
new ErrorProvider(3) {NotNull = string.Empty, Unique = 32};
101-
session.SaveChanges();
102-
Assert.Fail();
103-
}
104-
catch (UniqueConstraintViolationException exception) {
105-
Assert.AreEqual(Domain.Model.Types[typeof (ErrorProvider)], exception.Info.Type);
106-
}
107-
}
85+
using (var session = Domain.OpenSession())
86+
using (var t = session.OpenTransaction()) {
87+
_ = new ErrorProvider(3) { NotNull = string.Empty, Unique = 32 };
88+
89+
var ex = Assert.Throws<UniqueConstraintViolationException>(() => session.SaveChanges());
90+
Assert.That(ex.Info.Type, Is.EqualTo(Domain.Model.Types[typeof(ErrorProvider)]));
10891
}
10992
}
11093
}

0 commit comments

Comments
 (0)