Skip to content

Commit 1cb1064

Browse files
committed
Merge branch '7.0' into 7.1
# Conflicts: # Orm/Xtensive.Orm.Manual/Xtensive.Orm.Manual.csproj # Orm/Xtensive.Orm.Tests.Framework/Orm.config # Orm/Xtensive.Orm.Tests/Upgrade/GeneratorUpgrade/MultischemaTest.cs
2 parents 95c5f85 + 9864cc6 commit 1cb1064

9 files changed

Lines changed: 213 additions & 166 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

@@ -78,12 +83,22 @@
7883
<domain name="pgsql170"
7984
connectionUrl="postgresql://dotest:dotest@localhost:54170/dotest" />
8085

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

8494
<domain name="oracle11"
8595
connectionUrl="oracle://dotest:dotest@localhost:5511/ora11" />
8696

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

@@ -120,6 +135,11 @@
120135
<domain name="mysql93"
121136
connectionUrl="mysql://dotest:dotest@localhost:3393/dotest" />
122137

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

@@ -132,6 +152,11 @@
132152
<domain name="firebird50"
133153
connectionUrl="firebird://dotest:dotest@localhost:3055/dotest" />
134154

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

@@ -167,6 +192,11 @@
167192
<domain name="mssql2022cs" provider="sqlserver"
168193
connectionString="Data Source=localhost\DO_SQL2022,1422;Initial Catalog=DO-Tests;User ID=dotest;Password=dotest;MultipleActiveResultSets=True;Encrypt=false" />
169194

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

@@ -209,12 +239,22 @@
209239
<domain name="pgsql170cs" provider="postgresql"
210240
connectionString="HOST=localhost;PORT=54170;DATABASE=dotest;USER ID=dotest;PASSWORD=dotest" />
211241

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

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

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

@@ -251,6 +291,11 @@
251291
<domain name="mysql93cs" provider="mysql"
252292
connectionString="Server=localhost;Port=3393;Database=dotest;Uid=dotest;Pwd=dotest" />
253293

294+
<!-- A hook to have abitity to check and test newer, yet not supported, versions without adding them to the file -->
295+
<!-- This allows to override it in storage configuration files -->
296+
<domain name="mysqlnextcs" provider="mysql"
297+
connectionString="Server=localhost;Port=3393;Database=dotest;Uid=dotest;Pwd=dotest" />
298+
254299
<domain name="firebird25cs" provider="firebird"
255300
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" />
256301

@@ -263,6 +308,11 @@
263308
<domain name="firebird50cs" provider="firebird"
264309
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" />
265310

311+
<!-- A hook to have abitity to check and test newer, yet not supported, versions without adding them to the file -->
312+
<!-- This allows to override it in storage configuration files -->
313+
<domain name="firebirdnextcs" provider="firebird"
314+
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" />
315+
266316
<domain name="sqlite3cs" provider="sqlite"
267317
connectionString="Data Source=DO-Tests.db3" />
268318
</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)