Skip to content

Commit 328f039

Browse files
committed
Make some tests be compatible with Oracle
- some tests cases were ignored due to Oracle particularities - some broken test were fixed in order to fit Oracle limitations
1 parent bd0dbfa commit 328f039

File tree

4 files changed

+160
-158
lines changed

4 files changed

+160
-158
lines changed

Orm/Xtensive.Orm.Tests/Storage/IgnoreRulesValidateTest.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -371,13 +371,13 @@ public void IgnoreReferencedTableTest()
371371
if (createConstraintsWithTable) {
372372
var delayedOp = CreateTableDelayed(catalog, schema, "MyIgnoredEntity", addedColumnsNames, addedColumnsTypes);
373373
CreatePrimaryKeyLocally(catalog, schema, "MyIgnoredEntity", "Id", "PK_MyIgnoredEntity_Id");
374-
CreateForeignKeyLocally(catalog, schema, "MyIgnoredEntity", "MyEntity2Id", "MyEntity2", "Id", "FK_MyIgnoredEntity_MyEntity2_Id");
374+
CreateForeignKeyLocally(catalog, schema, "MyIgnoredEntity", "MyEntity2Id", "MyEntity2", "Id", "FK_MyIgnoredEntityMyEntity2Id");
375375
delayedOp();
376376
}
377377
else {
378378
CreateTable(catalog, schema, "MyIgnoredEntity", addedColumnsNames, addedColumnsTypes);
379379
CreatePrimaryKeyInDb(catalog, schema, "MyIgnoredEntity", "Id", "PK_MyIgnoredEntity_Id");
380-
CreateForeignKeyInDb(catalog, schema, "MyIgnoredEntity", "MyEntity2Id", "MyEntity2", "Id", "FK_MyIgnoredEntity_MyEntity2_Id");
380+
CreateForeignKeyInDb(catalog, schema, "MyIgnoredEntity", "MyEntity2Id", "MyEntity2", "Id", "FK_MyIgnoredEntityMyEntity2Id");
381381
}
382382

383383
var ignoreRules = new IgnoreRuleCollection();
@@ -608,7 +608,7 @@ public void UpgradeDomainWithIgnoreRuleByMaskInPerformSafelyModeTest()
608608
[Test]
609609
public void MultischemaValidateTest()
610610
{
611-
Require.AllFeaturesSupported(ProviderFeatures.Multischema | ProviderFeatures.Multidatabase);
611+
Require.AllFeaturesSupported(ProviderFeatures.Multischema);
612612

613613
SetMultischema();
614614

@@ -620,13 +620,13 @@ public void MultischemaValidateTest()
620620

621621
catalog = GetCatalog();
622622
CreateColumn(catalog, Schema2, "MyEntity2", "ReferencedIgnoredColumn", GetTypeForInteger(SqlType.Int64));
623-
CreateForeignKeyInDb(catalog, Schema2, "MyEntity2", "ReferencedIgnoredColumn", "MyEntity1", "Id", "FK_MyEntity2_MyEntity1_MyEntity1ID");
623+
CreateForeignKeyInDb(catalog, Schema2, "MyEntity2", "ReferencedIgnoredColumn", "MyEntity1", "Id", "FK_MyEnt2MyEnt1MyEnt1Id");
624624

625625
var addedColumnsNames = new[] { "Id", "FirstColumn", "MyEntity2Id" };
626626
var addedColumnsTypes = new[] { GetTypeForInteger(SqlType.Int32), GetTypeForInteger(SqlType.Int64), GetTypeForInteger(SqlType.Int64) };
627627
CreateTable(catalog, Schema2, "MyIgnoredEntity", addedColumnsNames, addedColumnsTypes);
628628
CreatePrimaryKeyInDb(catalog, Schema2, "MyIgnoredEntity", "Id", "PK_MyIgnoreTable_Id");
629-
CreateForeignKeyInDb(catalog, Schema2, "MyIgnoredEntity", "MyEntity2Id", "MyEntity2", "Id", "FK_MyIgnoredEntity_MyEntity2_Id");
629+
CreateForeignKeyInDb(catalog, Schema2, "MyIgnoredEntity", "MyEntity2Id", "MyEntity2", "Id", "FK_MyIgnoredEntityMyEntity2Id");
630630

631631
var ignoreRules = new IgnoreRuleCollection();
632632
_ = ignoreRules.IgnoreColumn("ReferencedIgnoredColumn").WhenSchema(Schema2);
@@ -670,7 +670,7 @@ public void MultidatabaseValidateTest()
670670
[Test]
671671
public void MultischemaUpgrageInPerformModeTest()
672672
{
673-
Require.AllFeaturesSupported(ProviderFeatures.Multischema | ProviderFeatures.Multidatabase);
673+
Require.AllFeaturesSupported(ProviderFeatures.Multischema);
674674

675675
SetMultischema();
676676

@@ -681,13 +681,13 @@ public void MultischemaUpgrageInPerformModeTest()
681681

682682
catalog = GetCatalog();
683683
CreateColumn(catalog, Schema2, "MyEntity2", "ReferencedIgnoredColumn", GetTypeForInteger(SqlType.Int64));
684-
CreateForeignKeyInDb(catalog, Schema2, "MyEntity2", "ReferencedIgnoredColumn", "MyEntity1", "Id", "FK_MyEntity2_MyEntity1_MyEntity1ID");
684+
CreateForeignKeyInDb(catalog, Schema2, "MyEntity2", "ReferencedIgnoredColumn", "MyEntity1", "Id", "FK_MyEnt2MyEnt1MyEnt1Id");
685685

686686
var addedColumnsNames = new[] { "Id", "FirstColumn", "MyEntity2Id" };
687687
var addedColumnsTypes = new[] { GetTypeForInteger(SqlType.Int32), GetTypeForInteger(SqlType.Int64), GetTypeForInteger(SqlType.Int64) };
688688
CreateTable(catalog, Schema2, "MyIgnoredEntity", addedColumnsNames, addedColumnsTypes);
689689
CreatePrimaryKeyInDb(catalog, Schema2, "MyIgnoredEntity", "Id", "PK_MyIgnoreTable_Id");
690-
CreateForeignKeyInDb(catalog, Schema2, "MyIgnoredEntity", "MyEntity2Id", "MyEntity2", "Id", "FK_MyIgnoredEntity_MyEntity2_Id");
690+
CreateForeignKeyInDb(catalog, Schema2, "MyIgnoredEntity", "MyEntity2Id", "MyEntity2", "Id", "FK_MyIgnoredEntityMyEntity2Id");
691691

692692
var ignoreRules = new IgnoreRuleCollection();
693693
_ = ignoreRules.IgnoreColumn("ReferencedIgnoredColumn").WhenSchema(Schema2);
@@ -707,7 +707,7 @@ public void MultischemaUpgrageInPerformModeTest()
707707
[Test]
708708
public void MultischemaUpgrageInPerformSafelyModeTest()
709709
{
710-
Require.AllFeaturesSupported(ProviderFeatures.Multischema | ProviderFeatures.Multidatabase);
710+
Require.AllFeaturesSupported(ProviderFeatures.Multischema);
711711

712712
SetMultischema();
713713

@@ -718,13 +718,13 @@ public void MultischemaUpgrageInPerformSafelyModeTest()
718718

719719
catalog = GetCatalog();
720720
CreateColumn(catalog, Schema2, "MyEntity2", "ReferencedIgnoredColumn", GetTypeForInteger(SqlType.Int64));
721-
CreateForeignKeyInDb(catalog, Schema2, "MyEntity2", "ReferencedIgnoredColumn", "MyEntity1", "Id", "FK_MyEntity2_MyEntity1_MyEntity1ID");
721+
CreateForeignKeyInDb(catalog, Schema2, "MyEntity2", "ReferencedIgnoredColumn", "MyEntity1", "Id", "FK_MyEnt2MyEnt1MyEnt1Id");
722722

723723
var addedColumnsNames = new[] { "Id", "FirstColumn", "MyEntity2Id" };
724724
var addedColumnsTypes = new[] { GetTypeForInteger(SqlType.Int32), GetTypeForInteger(SqlType.Int64), GetTypeForInteger(SqlType.Int64) };
725725
CreateTable(catalog, Schema2, "MyIgnoredEntity", addedColumnsNames, addedColumnsTypes);
726726
CreatePrimaryKeyInDb(catalog, Schema2, "MyIgnoredEntity", "Id", "PK_MyIgnoreTable_Id");
727-
CreateForeignKeyInDb(catalog, Schema2, "MyIgnoredEntity", "MyEntity2Id", "MyEntity2", "Id", "FK_MyIgnoredEntity_MyEntity2_Id");
727+
CreateForeignKeyInDb(catalog, Schema2, "MyIgnoredEntity", "MyEntity2Id", "MyEntity2", "Id", "FK_MyIgnoredEntityMyEntity2Id");
728728

729729
var ignoreRules = new IgnoreRuleCollection();
730730
_ = ignoreRules.IgnoreColumn("ReferencedIgnoredColumn").WhenSchema(Schema2);
@@ -835,6 +835,7 @@ private Domain BuildComplexDomain(DomainUpgradeMode mode, IgnoreRuleCollection i
835835
foreach (var type in secondPartTypes) {
836836
config.MappingRules.Map(type.Assembly, type.Namespace).ToSchema(Schema2);
837837
}
838+
config.DefaultSchema = defaultSchema;
838839
}
839840
else if (isMultidatabaseTest) {
840841
foreach (var type in firstPartTypes) {
@@ -844,11 +845,10 @@ private Domain BuildComplexDomain(DomainUpgradeMode mode, IgnoreRuleCollection i
844845
foreach (var type in secondPartTypes) {
845846
config.MappingRules.Map(type.Assembly, type.Namespace).ToDatabase(Multimapping.MultidatabaseTest.Database2Name);
846847
}
848+
config.DefaultSchema = defaultSchema;
849+
config.DefaultDatabase = GetConnectionInfo().ConnectionUrl.GetDatabase();
847850
}
848851

849-
config.DefaultSchema = defaultSchema;
850-
config.DefaultDatabase = GetConnectionInfo().ConnectionUrl.GetDatabase();
851-
852852
foreach (var type in firstPartTypes.Union(secondPartTypes)) {
853853
config.Types.Register(type.Assembly, type.Namespace);
854854
}

Orm/Xtensive.Orm.Tests/Storage/NewProfilesTest.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using NUnit.Framework;
1212
using Xtensive.Orm.Configuration;
1313
using Xtensive.Orm.Internals;
14+
using Xtensive.Orm.Providers;
1415
using Xtensive.Orm.Tests.Storage.NewClientProfileTestModel;
1516

1617
namespace Xtensive.Orm.Tests.Storage.NewClientProfileTestModel
@@ -790,6 +791,8 @@ public void ServerProfileCancelingOfEntitySetChanges()
790791
[Test]
791792
public void ClientProfileVersionsTest()
792793
{
794+
Require.ProviderIsNot(StorageProvider.Oracle, "ExecuteNonQuery returns -1 all the time so versioning is not working");
795+
793796
var sessionConfiguration = new SessionConfiguration(SessionOptions.ClientProfile | SessionOptions.AutoActivation | SessionOptions.ValidateEntityVersions);
794797

795798
using (var session = Domain.OpenSession(sessionConfiguration)) {

Orm/Xtensive.Orm.Tests/Storage/SkippingValidationOnCommitTest.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
using Xtensive.Orm.Tests.Model.Association;
1414
using Xtensive.Orm.Validation;
1515
using Xtensive.Orm.Tests.Storage.SkippingValidationOnCommitTestModel;
16+
using Xtensive.Orm.Providers;
1617

1718
namespace Xtensive.Orm.Tests.Storage
1819
{
@@ -527,6 +528,8 @@ public void LenghtConstraintNotImmediateSkippedTest()
527528
[Test]
528529
public void NotEmptyConstraintImmediateNotSkippedTest()
529530
{
531+
Require.AllFeaturesNotSupported(ProviderFeatures.TreatEmptyStringAsNull);
532+
530533
using (var session = Domain.OpenSession())
531534
using (var transaction = session.OpenTransaction()) {
532535
var entity = session.Query.All<NotEmptyTestEntity1>().First();
@@ -563,6 +566,8 @@ public void NotEmptyConstraintImmediateNotSkippedTest()
563566
[Test]
564567
public void NotEmptyConstraintImmediateSkippedTest()
565568
{
569+
Require.AllFeaturesNotSupported(ProviderFeatures.TreatEmptyStringAsNull);
570+
566571
using (var session = Domain.OpenSession())
567572
using (var transaction = session.OpenTransaction()) {
568573
var entity = session.Query.All<NotEmptyTestEntity2>().First();
@@ -597,6 +602,8 @@ public void NotEmptyConstraintImmediateSkippedTest()
597602
[Test]
598603
public void NotEmptyConstraintNotImmidiateNotSkippedTest()
599604
{
605+
Require.AllFeaturesNotSupported(ProviderFeatures.TreatEmptyStringAsNull);
606+
600607
using (var session = Domain.OpenSession())
601608
using (var transaction = session.OpenTransaction()) {
602609
var entity = session.Query.All<EmailTestEntity3>().First();
@@ -633,6 +640,8 @@ public void NotEmptyConstraintNotImmidiateNotSkippedTest()
633640
[Test]
634641
public void NotEmptyConstraintNotImmediateSkippedTest()
635642
{
643+
Require.AllFeaturesNotSupported(ProviderFeatures.TreatEmptyStringAsNull);
644+
636645
using (var session = Domain.OpenSession())
637646
using (var transaction = session.OpenTransaction()) {
638647
var entity = session.Query.All<NotEmptyTestEntity4>().First();

0 commit comments

Comments
 (0)